code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
from mod_python import apache
import os
def authenhandler(req, **kwargs):
"""
Authentication handler that checks against Django's auth database.
"""
# mod_python fakes the environ, and thus doesn't process SetEnv. This fixes
# that so that the following import works
os.environ.update(req.subp... | [
[
1,
0,
0.0179,
0.0179,
0,
0.66,
0,
889,
0,
1,
0,
0,
889,
0,
0
],
[
1,
0,
0.0357,
0.0179,
0,
0.66,
0.5,
688,
0,
1,
0,
0,
688,
0,
0
],
[
2,
0,
0.5357,
0.9464,
0,
0.6... | [
"from mod_python import apache",
"import os",
"def authenhandler(req, **kwargs):\n \"\"\"\n Authentication handler that checks against Django's auth database.\n \"\"\"\n\n # mod_python fakes the environ, and thus doesn't process SetEnv. This fixes\n # that so that the following import works\n ... |
from django.dispatch import Signal
user_logged_in = Signal(providing_args=['request', 'user'])
user_logged_out = Signal(providing_args=['request', 'user'])
| [
[
1,
0,
0.25,
0.25,
0,
0.66,
0,
548,
0,
1,
0,
0,
548,
0,
0
],
[
14,
0,
0.75,
0.25,
0,
0.66,
0.5,
712,
3,
1,
0,
0,
592,
10,
1
],
[
14,
0,
1,
0.25,
0,
0.66,
1,
... | [
"from django.dispatch import Signal",
"user_logged_in = Signal(providing_args=['request', 'user'])",
"user_logged_out = Signal(providing_args=['request', 'user'])"
] |
from django.conf import settings
from django.contrib.auth.models import User, Group, Permission, AnonymousUser
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
class BackendTest(TestCase):
backend = 'django.contrib... | [
[
1,
0,
0.0032,
0.0032,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0065,
0.0032,
0,
0.66,
0.0667,
808,
0,
4,
0,
0,
808,
0,
0
],
[
1,
0,
0.0097,
0.0032,
0,
... | [
"from django.conf import settings",
"from django.contrib.auth.models import User, Group, Permission, AnonymousUser",
"from django.contrib.contenttypes.models import ContentType",
"from django.core.exceptions import ImproperlyConfigured",
"from django.test import TestCase",
"class BackendTest(TestCase):\n\... |
from __future__ import with_statement
import os
from django.contrib.auth.models import User
from django.contrib.auth.forms import (UserCreationForm, AuthenticationForm,
PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm)
from django.core import mail
from django.forms.fields import Field, EmailFi... | [
[
1,
0,
0.0029,
0.0029,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0059,
0.0029,
0,
0.66,
0.0455,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0088,
0.0029,
0,
... | [
"from __future__ import with_statement",
"import os",
"from django.contrib.auth.models import User",
"from django.contrib.auth.forms import (UserCreationForm, AuthenticationForm,\n PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm)",
"from django.core import mail",
"from django.for... |
import os
from django.conf import global_settings
from django.contrib.auth import authenticate
from django.contrib.auth.context_processors import PermWrapper, PermLookupDict
from django.db.models import Q
from django.template import context
from django.test import TestCase
from django.test.utils import override_settin... | [
[
1,
0,
0.0067,
0.0067,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.02,
0.0067,
0,
0.66,
0.0909,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0267,
0.0067,
0,
0.... | [
"import os",
"from django.conf import global_settings",
"from django.contrib.auth import authenticate",
"from django.contrib.auth.context_processors import PermWrapper, PermLookupDict",
"from django.db.models import Q",
"from django.template import context",
"from django.test import TestCase",
"from d... |
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
from django.contrib.auth.models import (Group, User,
SiteProfileNotAvailable, UserManager)
class ProfileTestCase(TestCase):
fixtures = ['authtestdata.json']
def setUp(self):
"""Backs ... | [
[
1,
0,
0.0093,
0.0093,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0187,
0.0093,
0,
0.66,
0.0833,
944,
0,
1,
0,
0,
944,
0,
0
],
[
1,
0,
0.028,
0.0093,
0,
0... | [
"from django.conf import settings",
"from django.test import TestCase",
"from django.test.utils import override_settings",
"from django.contrib.auth.models import (Group, User,\n SiteProfileNotAvailable, UserManager)",
"class ProfileTestCase(TestCase):\n fixtures = ['authtestdata.json']\n\n def set... |
from django.test import TestCase
from django.test.utils import override_settings
from django.contrib.auth import signals
class SignalTestCase(TestCase):
urls = 'django.contrib.auth.tests.urls'
fixtures = ['authtestdata.json']
def listener_login(self, user, **kwargs):
self.logged_in.append(user)
... | [
[
1,
0,
0.02,
0.02,
0,
0.66,
0,
944,
0,
1,
0,
0,
944,
0,
0
],
[
1,
0,
0.04,
0.02,
0,
0.66,
0.25,
768,
0,
1,
0,
0,
768,
0,
0
],
[
1,
0,
0.06,
0.02,
0,
0.66,
0.5,... | [
"from django.test import TestCase",
"from django.test.utils import override_settings",
"from django.contrib.auth import signals",
"class SignalTestCase(TestCase):\n urls = 'django.contrib.auth.tests.urls'\n fixtures = ['authtestdata.json']\n\n def listener_login(self, user, **kwargs):\n self.l... |
from django.test import TestCase
from django.utils.unittest import skipUnless
from django.contrib.auth.models import User, AnonymousUser
from django.core.management import call_command
from StringIO import StringIO
try:
import crypt as crypt_module
except ImportError:
crypt_module = None
class BasicTestCase(... | [
[
1,
0,
0.0089,
0.0089,
0,
0.66,
0,
944,
0,
1,
0,
0,
944,
0,
0
],
[
1,
0,
0.0179,
0.0089,
0,
0.66,
0.1667,
270,
0,
1,
0,
0,
270,
0,
0
],
[
1,
0,
0.0268,
0.0089,
0,
... | [
"from django.test import TestCase",
"from django.utils.unittest import skipUnless",
"from django.contrib.auth.models import User, AnonymousUser",
"from django.core.management import call_command",
"from StringIO import StringIO",
"try:\n import crypt as crypt_module\nexcept ImportError:\n crypt_modu... |
from django.conf.urls import patterns, url
from django.contrib.auth import context_processors
from django.contrib.auth.urls import urlpatterns
from django.contrib.auth.views import password_reset
from django.contrib.auth.decorators import login_required
from django.contrib.messages.api import info
from django.http impo... | [
[
1,
0,
0.0154,
0.0154,
0,
0.66,
0,
528,
0,
2,
0,
0,
528,
0,
0
],
[
1,
0,
0.0308,
0.0154,
0,
0.66,
0.0588,
895,
0,
1,
0,
0,
895,
0,
0
],
[
1,
0,
0.0462,
0.0154,
0,
... | [
"from django.conf.urls import patterns, url",
"from django.contrib.auth import context_processors",
"from django.contrib.auth.urls import urlpatterns",
"from django.contrib.auth.views import password_reset",
"from django.contrib.auth.decorators import login_required",
"from django.contrib.messages.api imp... |
from django.conf.global_settings import PASSWORD_HASHERS as default_hashers
from django.contrib.auth.hashers import (is_password_usable,
check_password, make_password, PBKDF2PasswordHasher, load_hashers,
PBKDF2SHA1PasswordHasher, get_hasher, UNUSABLE_PASSWORD)
from django.utils import unittest
from django.util... | [
[
1,
0,
0.0075,
0.0075,
0,
0.66,
0,
930,
0,
1,
0,
0,
930,
0,
0
],
[
1,
0,
0.0226,
0.0226,
0,
0.66,
0.1429,
865,
0,
8,
0,
0,
865,
0,
0
],
[
1,
0,
0.0376,
0.0075,
0,
... | [
"from django.conf.global_settings import PASSWORD_HASHERS as default_hashers",
"from django.contrib.auth.hashers import (is_password_usable, \n check_password, make_password, PBKDF2PasswordHasher, load_hashers,\n PBKDF2SHA1PasswordHasher, get_hasher, UNUSABLE_PASSWORD)",
"from django.utils import unittest... |
from datetime import datetime
from django.conf import settings
from django.contrib.auth.backends import RemoteUserBackend
from django.contrib.auth.models import User
from django.test import TestCase
from django.utils import timezone
class RemoteUserTest(TestCase):
urls = 'django.contrib.auth.tests.urls'
mid... | [
[
1,
0,
0.0058,
0.0058,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0173,
0.0058,
0,
0.66,
0.1,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0231,
0.0058,
0,
0.6... | [
"from datetime import datetime",
"from django.conf import settings",
"from django.contrib.auth.backends import RemoteUserBackend",
"from django.contrib.auth.models import User",
"from django.test import TestCase",
"from django.utils import timezone",
"class RemoteUserTest(TestCase):\n\n urls = 'djang... |
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.tests.views import AuthViewsTestCase
class LoginRequiredTestCase(AuthViewsTestCase):
"""
Tests the login_required decorators
"""
urls = 'django.contrib.auth.tests.urls'
def testCalla... | [
[
1,
0,
0.0217,
0.0217,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0435,
0.0217,
0,
0.66,
0.3333,
885,
0,
1,
0,
0,
885,
0,
0
],
[
1,
0,
0.0652,
0.0217,
0,
... | [
"from django.conf import settings",
"from django.contrib.auth.decorators import login_required",
"from django.contrib.auth.tests.views import AuthViewsTestCase",
"class LoginRequiredTestCase(AuthViewsTestCase):\n \"\"\"\n Tests the login_required decorators\n \"\"\"\n urls = 'django.contrib.auth.t... |
from datetime import date, timedelta
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.test import TestCase
class TokenGeneratorTest(TestCase):
def test_make_token(self):
"""
Ensure that we ... | [
[
1,
0,
0.0156,
0.0156,
0,
0.66,
0,
426,
0,
2,
0,
0,
426,
0,
0
],
[
1,
0,
0.0469,
0.0156,
0,
0.66,
0.2,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0625,
0.0156,
0,
0.6... | [
"from datetime import date, timedelta",
"from django.conf import settings",
"from django.contrib.auth.models import User",
"from django.contrib.auth.tokens import PasswordResetTokenGenerator",
"from django.test import TestCase",
"class TokenGeneratorTest(TestCase):\n\n def test_make_token(self):\n ... |
from __future__ import with_statement
import os
import re
import urllib
from django.conf import settings
from django.contrib.sites.models import Site, RequestSite
from django.contrib.auth.models import User
from django.core import mail
from django.core.exceptions import SuspiciousOperation
from django.core.urlresolver... | [
[
1,
0,
0.002,
0.002,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.004,
0.002,
0,
0.66,
0.0417,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.006,
0.002,
0,
0.66,
... | [
"from __future__ import with_statement",
"import os",
"import re",
"import urllib",
"from django.conf import settings",
"from django.contrib.sites.models import Site, RequestSite",
"from django.contrib.auth.models import User",
"from django.core import mail",
"from django.core.exceptions import Susp... |
from StringIO import StringIO
from django.contrib.auth import models, management
from django.contrib.auth.management.commands import changepassword
from django.test import TestCase
class GetDefaultUsernameTestCase(TestCase):
def setUp(self):
self._getpass_getuser = management.get_system_username
de... | [
[
1,
0,
0.0141,
0.0141,
0,
0.66,
0,
609,
0,
1,
0,
0,
609,
0,
0
],
[
1,
0,
0.0423,
0.0141,
0,
0.66,
0.2,
895,
0,
2,
0,
0,
895,
0,
0
],
[
1,
0,
0.0563,
0.0141,
0,
0.6... | [
"from StringIO import StringIO",
"from django.contrib.auth import models, management",
"from django.contrib.auth.management.commands import changepassword",
"from django.test import TestCase",
"class GetDefaultUsernameTestCase(TestCase):\n\n def setUp(self):\n self._getpass_getuser = management.ge... |
from django.contrib.auth.tests.auth_backends import (BackendTest,
RowlevelBackendTest, AnonymousUserBackendTest, NoBackendsTest,
InActiveUserBackendTest, NoInActiveUserBackendTest)
from django.contrib.auth.tests.basic import BasicTestCase
from django.contrib.auth.tests.context_processors import AuthContextProce... | [
[
1,
0,
0.0769,
0.1154,
0,
0.66,
0,
769,
0,
6,
0,
0,
769,
0,
0
],
[
1,
0,
0.1538,
0.0385,
0,
0.66,
0.0909,
879,
0,
1,
0,
0,
879,
0,
0
],
[
1,
0,
0.1923,
0.0385,
0,
... | [
"from django.contrib.auth.tests.auth_backends import (BackendTest,\n RowlevelBackendTest, AnonymousUserBackendTest, NoBackendsTest,\n InActiveUserBackendTest, NoInActiveUserBackendTest)",
"from django.contrib.auth.tests.basic import BasicTestCase",
"from django.contrib.auth.tests.context_processors import... |
# The views used below are normally mapped in django.contrib.admin.urls.py
# This URLs file is used to provide a reliable view deployment for test purposes.
# It is also provided as a convenience to those who want to deploy these URLs
# elsewhere.
from django.conf.urls import patterns, url
urlpatterns = patterns('',
... | [
[
1,
0,
0.3158,
0.0526,
0,
0.66,
0,
528,
0,
2,
0,
0,
528,
0,
0
],
[
14,
0,
0.7105,
0.6316,
0,
0.66,
1,
990,
3,
9,
0,
0,
75,
10,
9
]
] | [
"from django.conf.urls import patterns, url",
"urlpatterns = patterns('',\n url(r'^login/$', 'django.contrib.auth.views.login', name='login'),\n url(r'^logout/$', 'django.contrib.auth.views.logout', name='logout'),\n url(r'^password_change/$', 'django.contrib.auth.views.password_change', name='password_c... |
from django.contrib import auth
from django.core.exceptions import ImproperlyConfigured
from django.utils.functional import SimpleLazyObject
def get_user(request):
if not hasattr(request, '_cached_user'):
request._cached_user = auth.get_user(request)
return request._cached_user
class AuthenticationM... | [
[
1,
0,
0.0125,
0.0125,
0,
0.66,
0,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.025,
0.0125,
0,
0.66,
0.2,
160,
0,
1,
0,
0,
160,
0,
0
],
[
1,
0,
0.0375,
0.0125,
0,
0.66... | [
"from django.contrib import auth",
"from django.core.exceptions import ImproperlyConfigured",
"from django.utils.functional import SimpleLazyObject",
"def get_user(request):\n if not hasattr(request, '_cached_user'):\n request._cached_user = auth.get_user(request)\n return request._cached_user",
... |
import hashlib
from django.conf import settings
from django.utils import importlib
from django.utils.datastructures import SortedDict
from django.utils.encoding import smart_str
from django.core.exceptions import ImproperlyConfigured
from django.utils.crypto import (
pbkdf2, constant_time_compare, get_random_strin... | [
[
1,
0,
0.0025,
0.0025,
0,
0.66,
0,
154,
0,
1,
0,
0,
154,
0,
0
],
[
1,
0,
0.0076,
0.0025,
0,
0.66,
0.0417,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0102,
0.0025,
0,
... | [
"import hashlib",
"from django.conf import settings",
"from django.utils import importlib",
"from django.utils.datastructures import SortedDict",
"from django.utils.encoding import smart_str",
"from django.core.exceptions import ImproperlyConfigured",
"from django.utils.crypto import (\n pbkdf2, cons... |
import urlparse
from functools import wraps
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.exceptions import PermissionDenied
from django.utils.decorators import available_attrs
def user_passes_test(test_func, login_url=None, redirect_field_name=REDIRECT_FIELD_NA... | [
[
1,
0,
0.0149,
0.0149,
0,
0.66,
0,
857,
0,
1,
0,
0,
857,
0,
0
],
[
1,
0,
0.0299,
0.0149,
0,
0.66,
0.125,
711,
0,
1,
0,
0,
711,
0,
0
],
[
1,
0,
0.0448,
0.0149,
0,
0... | [
"import urlparse",
"from functools import wraps",
"from django.conf import settings",
"from django.contrib.auth import REDIRECT_FIELD_NAME",
"from django.core.exceptions import PermissionDenied",
"from django.utils.decorators import available_attrs",
"def user_passes_test(test_func, login_url=None, redi... |
from django.db import transaction
from django.conf import settings
from django.contrib import admin
from django.contrib.auth.forms import (UserCreationForm, UserChangeForm,
AdminPasswordChangeForm)
from django.contrib.auth.models import User, Group
from django.contrib import messages
from django.core.exceptions imp... | [
[
1,
0,
0.0058,
0.0058,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0116,
0.0058,
0,
0.66,
0.05,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0173,
0.0058,
0,
0.66... | [
"from django.db import transaction",
"from django.conf import settings",
"from django.contrib import admin",
"from django.contrib.auth.forms import (UserCreationForm, UserChangeForm,\n AdminPasswordChangeForm)",
"from django.contrib.auth.models import User, Group",
"from django.contrib import messages"... |
"""
Management utility to create superusers.
"""
import getpass
import re
import sys
from optparse import make_option
from django.contrib.auth.models import User
from django.contrib.auth.management import get_default_username
from django.core import exceptions
from django.core.management.base import BaseCommand, Comm... | [
[
8,
0,
0.0157,
0.0236,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0394,
0.0079,
0,
0.66,
0.0714,
784,
0,
1,
0,
0,
784,
0,
0
],
[
1,
0,
0.0472,
0.0079,
0,
0.66... | [
"\"\"\"\nManagement utility to create superusers.\n\"\"\"",
"import getpass",
"import re",
"import sys",
"from optparse import make_option",
"from django.contrib.auth.models import User",
"from django.contrib.auth.management import get_default_username",
"from django.core import exceptions",
"from d... |
import getpass
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from django.db import DEFAULT_DB_ALIAS
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--database', action='stor... | [
[
1,
0,
0.0179,
0.0179,
0,
0.66,
0,
784,
0,
1,
0,
0,
784,
0,
0
],
[
1,
0,
0.0357,
0.0179,
0,
0.66,
0.2,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.0714,
0.0179,
0,
0.6... | [
"import getpass",
"from optparse import make_option",
"from django.core.management.base import BaseCommand, CommandError",
"from django.contrib.auth.models import User",
"from django.db import DEFAULT_DB_ALIAS",
"class Command(BaseCommand):\n option_list = BaseCommand.option_list + (\n make_opti... |
"""
Creates permissions for all installed apps that need permissions.
"""
import getpass
import locale
import unicodedata
from django.contrib.auth import models as auth_app
from django.db.models import get_models, signals
from django.contrib.auth.models import User
def _get_permission_codename(action, opts):
retu... | [
[
8,
0,
0.0157,
0.0236,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0315,
0.0079,
0,
0.66,
0.0714,
784,
0,
1,
0,
0,
784,
0,
0
],
[
1,
0,
0.0394,
0.0079,
0,
0.66... | [
"\"\"\"\nCreates permissions for all installed apps that need permissions.\n\"\"\"",
"import getpass",
"import locale",
"import unicodedata",
"from django.contrib.auth import models as auth_app",
"from django.db.models import get_models, signals",
"from django.contrib.auth.models import User",
"def _g... |
from datetime import date
from django.conf import settings
from django.utils.http import int_to_base36, base36_to_int
from django.utils.crypto import constant_time_compare, salted_hmac
class PasswordResetTokenGenerator(object):
"""
Strategy object used to generate and check tokens for the password
reset me... | [
[
1,
0,
0.0141,
0.0141,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0282,
0.0141,
0,
0.66,
0.2,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0423,
0.0141,
0,
0.6... | [
"from datetime import date",
"from django.conf import settings",
"from django.utils.http import int_to_base36, base36_to_int",
"from django.utils.crypto import constant_time_compare, salted_hmac",
"class PasswordResetTokenGenerator(object):\n \"\"\"\n Strategy object used to generate and check tokens ... |
import urlparse
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, QueryDict
from django.template.response import TemplateResponse
from django.utils.http import base36_to_int, is_safe_url
from django.utils.translation import ugettext as _
from dj... | [
[
1,
0,
0.0038,
0.0038,
0,
0.66,
0,
857,
0,
1,
0,
0,
857,
0,
0
],
[
1,
0,
0.0115,
0.0038,
0,
0.66,
0.04,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0153,
0.0038,
0,
0.... | [
"import urlparse",
"from django.conf import settings",
"from django.core.urlresolvers import reverse",
"from django.http import HttpResponseRedirect, QueryDict",
"from django.template.response import TemplateResponse",
"from django.utils.http import base36_to_int, is_safe_url",
"from django.utils.transl... |
from django.db import models
from django.contrib.sites.models import Site
from django.utils.translation import ugettext_lazy as _
class Redirect(models.Model):
site = models.ForeignKey(Site)
old_path = models.CharField(_('redirect from'), max_length=200, db_index=True,
help_text=_("This should be an ab... | [
[
1,
0,
0.05,
0.05,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.1,
0.05,
0,
0.66,
0.3333,
890,
0,
1,
0,
0,
890,
0,
0
],
[
1,
0,
0.15,
0.05,
0,
0.66,
0.666... | [
"from django.db import models",
"from django.contrib.sites.models import Site",
"from django.utils.translation import ugettext_lazy as _",
"class Redirect(models.Model):\n site = models.ForeignKey(Site)\n old_path = models.CharField(_('redirect from'), max_length=200, db_index=True,\n help_text=_... |
from django.contrib.redirects.models import Redirect
from django import http
from django.conf import settings
class RedirectFallbackMiddleware(object):
def process_response(self, request, response):
if response.status_code != 404:
return response # No need to check for a redirect for non-404 re... | [
[
1,
0,
0.037,
0.037,
0,
0.66,
0,
909,
0,
1,
0,
0,
909,
0,
0
],
[
1,
0,
0.0741,
0.037,
0,
0.66,
0.3333,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.1111,
0.037,
0,
0.66... | [
"from django.contrib.redirects.models import Redirect",
"from django import http",
"from django.conf import settings",
"class RedirectFallbackMiddleware(object):\n def process_response(self, request, response):\n if response.status_code != 404:\n return response # No need to check for a r... |
from django.contrib import admin
from django.contrib.redirects.models import Redirect
class RedirectAdmin(admin.ModelAdmin):
list_display = ('old_path', 'new_path')
list_filter = ('site',)
search_fields = ('old_path', 'new_path')
radio_fields = {'site': admin.VERTICAL}
admin.site.register(Redirect, R... | [
[
1,
0,
0.1818,
0.0909,
0,
0.66,
0,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.2727,
0.0909,
0,
0.66,
0.3333,
909,
0,
1,
0,
0,
909,
0,
0
],
[
3,
0,
0.6364,
0.4545,
0,
... | [
"from django.contrib import admin",
"from django.contrib.redirects.models import Redirect",
"class RedirectAdmin(admin.ModelAdmin):\n list_display = ('old_path', 'new_path')\n list_filter = ('site',)\n search_fields = ('old_path', 'new_path')\n radio_fields = {'site': admin.VERTICAL}",
" list_d... |
# Empty models.py to allow for specifying admindocs as a test label.
| [] | [] |
from django.db import models
class CustomField(models.Field):
description = "A custom field type"
class DescriptionLackingField(models.Field):
pass
| [
[
1,
0,
0.1429,
0.1429,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
3,
0,
0.5,
0.2857,
0,
0.66,
0.5,
771,
0,
0,
0,
0,
922,
0,
0
],
[
14,
1,
0.5714,
0.1429,
1,
0.77,
... | [
"from django.db import models",
"class CustomField(models.Field):\n description = \"A custom field type\"",
" description = \"A custom field type\"",
"class DescriptionLackingField(models.Field):\n pass"
] |
from django.contrib.admindocs import views
from django.db.models import fields as builtin_fields
from django.utils import unittest
import fields
class TestFieldType(unittest.TestCase):
def setUp(self):
pass
def test_field_name(self):
self.assertRaises(AttributeError,
views.get_re... | [
[
1,
0,
0.0323,
0.0323,
0,
0.66,
0,
601,
0,
1,
0,
0,
601,
0,
0
],
[
1,
0,
0.0645,
0.0323,
0,
0.66,
0.25,
680,
0,
1,
0,
0,
680,
0,
0
],
[
1,
0,
0.0968,
0.0323,
0,
0.... | [
"from django.contrib.admindocs import views",
"from django.db.models import fields as builtin_fields",
"from django.utils import unittest",
"import fields",
"class TestFieldType(unittest.TestCase):\n def setUp(self):\n pass\n\n def test_field_name(self):\n self.assertRaises(AttributeErro... |
from django.conf.urls import patterns, url
from django.contrib.admindocs import views
urlpatterns = patterns('',
url('^$',
views.doc_index,
name='django-admindocs-docroot'
),
url('^bookmarklets/$',
views.bookmarklets,
name='django-admindocs-bookmarklets'
),
url('^tag... | [
[
1,
0,
0.0244,
0.0244,
0,
0.66,
0,
528,
0,
2,
0,
0,
528,
0,
0
],
[
1,
0,
0.0488,
0.0244,
0,
0.66,
0.5,
601,
0,
1,
0,
0,
601,
0,
0
],
[
14,
0,
0.5488,
0.9268,
0,
0.... | [
"from django.conf.urls import patterns, url",
"from django.contrib.admindocs import views",
"urlpatterns = patterns('',\n url('^$',\n views.doc_index,\n name='django-admindocs-docroot'\n ),\n url('^bookmarklets/$',\n views.bookmarklets,\n name='django-admindocs-bookmarklets'... |
"Misc. utility functions/classes for admin documentation generator."
import re
from email.parser import HeaderParser
from email.errors import HeaderParseError
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse
from django.utils.encoding import smart_str
try:
import docutils... | [
[
8,
0,
0.0094,
0.0094,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0283,
0.0094,
0,
0.66,
0.0714,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0377,
0.0094,
0,
0.66... | [
"\"Misc. utility functions/classes for admin documentation generator.\"",
"import re",
"from email.parser import HeaderParser",
"from email.errors import HeaderParseError",
"from django.utils.safestring import mark_safe",
"from django.core.urlresolvers import reverse",
"from django.utils.encoding import... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
SITE_CACHE = {}
class SiteManager(models.Manager):
def get_current(self):
"""
Returns the current ``Site`` based on the SITE_ID in the
project's settings. The ``Site`` object is cached the first
... | [
[
1,
0,
0.0105,
0.0105,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0211,
0.0105,
0,
0.66,
0.1667,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.0526,
0.0105,
0,
0... | [
"from django.db import models",
"from django.utils.translation import ugettext_lazy as _",
"SITE_CACHE = {}",
"class SiteManager(models.Manager):\n\n def get_current(self):\n \"\"\"\n Returns the current ``Site`` based on the SITE_ID in the\n project's settings. The ``Site`` object is ... |
from django.conf import settings
from django.contrib.sites.models import Site, RequestSite, get_current_site
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpRequest
from django.test import TestCase
class SitesFrameworkTests(TestCase):
def setUp(self):
Site(id=settings.SI... | [
[
1,
0,
0.0161,
0.0161,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0323,
0.0161,
0,
0.66,
0.2,
890,
0,
3,
0,
0,
890,
0,
0
],
[
1,
0,
0.0484,
0.0161,
0,
0.6... | [
"from django.conf import settings",
"from django.contrib.sites.models import Site, RequestSite, get_current_site",
"from django.core.exceptions import ObjectDoesNotExist",
"from django.http import HttpRequest",
"from django.test import TestCase",
"class SitesFrameworkTests(TestCase):\n\n def setUp(self... |
from django.conf import settings
from django.db import models
from django.db.models.fields import FieldDoesNotExist
class CurrentSiteManager(models.Manager):
"Use this to limit objects to those associated with the current site."
def __init__(self, field_name=None):
super(CurrentSiteManager, self).__ini... | [
[
1,
0,
0.0244,
0.0244,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0488,
0.0244,
0,
0.66,
0.3333,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0732,
0.0244,
0,
0.... | [
"from django.conf import settings",
"from django.db import models",
"from django.db.models.fields import FieldDoesNotExist",
"class CurrentSiteManager(models.Manager):\n \"Use this to limit objects to those associated with the current site.\"\n def __init__(self, field_name=None):\n super(Current... |
from django.contrib import admin
from django.contrib.sites.models import Site
class SiteAdmin(admin.ModelAdmin):
list_display = ('domain', 'name')
search_fields = ('domain', 'name')
admin.site.register(Site, SiteAdmin) | [
[
1,
0,
0.1111,
0.1111,
0,
0.66,
0,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.2222,
0.1111,
0,
0.66,
0.3333,
890,
0,
1,
0,
0,
890,
0,
0
],
[
3,
0,
0.6667,
0.3333,
0,
... | [
"from django.contrib import admin",
"from django.contrib.sites.models import Site",
"class SiteAdmin(admin.ModelAdmin):\n list_display = ('domain', 'name')\n search_fields = ('domain', 'name')",
" list_display = ('domain', 'name')",
" search_fields = ('domain', 'name')",
"admin.site.register(S... |
"""
Creates the default Site object.
"""
from django.db.models import signals
from django.db import connections
from django.db import router
from django.contrib.sites.models import Site
from django.contrib.sites import models as site_app
from django.core.management.color import no_style
def create_default_site(app, c... | [
[
8,
0,
0.0556,
0.0833,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1389,
0.0278,
0,
0.66,
0.125,
680,
0,
1,
0,
0,
680,
0,
0
],
[
1,
0,
0.1667,
0.0278,
0,
0.66,... | [
"\"\"\"\nCreates the default Site object.\n\"\"\"",
"from django.db.models import signals",
"from django.db import connections",
"from django.db import router",
"from django.contrib.sites.models import Site",
"from django.contrib.sites import models as site_app",
"from django.core.management.color impor... |
from functools import wraps
from django.utils.translation import ugettext as _
from django.contrib.admin.forms import AdminAuthenticationForm
from django.contrib.auth.views import login
from django.contrib.auth import REDIRECT_FIELD_NAME
def staff_member_required(view_func):
"""
Decorator for views that checks... | [
[
1,
0,
0.0345,
0.0345,
0,
0.66,
0,
711,
0,
1,
0,
0,
711,
0,
0
],
[
1,
0,
0.069,
0.0345,
0,
0.66,
0.2,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.1034,
0.0345,
0,
0.66... | [
"from functools import wraps",
"from django.utils.translation import ugettext as _",
"from django.contrib.admin.forms import AdminAuthenticationForm",
"from django.contrib.auth.views import login",
"from django.contrib.auth import REDIRECT_FIELD_NAME",
"def staff_member_required(view_func):\n \"\"\"\n ... |
from django import forms
from django.contrib.auth import authenticate
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy, ugettext as _
ERROR_MESSAGE = ugettext_lazy("Please enter the correct username and password "
... | [
[
1,
0,
0.0233,
0.0233,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0698,
0.0233,
0,
0.66,
0.1667,
895,
0,
1,
0,
0,
895,
0,
0
],
[
1,
0,
0.093,
0.0233,
0,
0... | [
"from django import forms",
"from django.contrib.auth import authenticate",
"from django.contrib.auth.forms import AuthenticationForm",
"from django.contrib.auth.models import User",
"from django.utils.translation import ugettext_lazy, ugettext as _",
"ERROR_MESSAGE = ugettext_lazy(\"Please enter the corr... |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User
from django.contrib.admin.util import quote
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
from django.utils.safestring import mark... | [
[
1,
0,
0.0147,
0.0147,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0294,
0.0147,
0,
0.66,
0.0909,
469,
0,
1,
0,
0,
469,
0,
0
],
[
1,
0,
0.0441,
0.0147,
0,
0.... | [
"from django.db import models",
"from django.contrib.contenttypes.models import ContentType",
"from django.contrib.auth.models import User",
"from django.contrib.admin.util import quote",
"from django.utils.translation import ugettext_lazy as _",
"from django.utils.encoding import smart_unicode",
"from ... |
from django.conf import settings
from django.template import Library
register = Library()
if 'django.contrib.staticfiles' in settings.INSTALLED_APPS:
from django.contrib.staticfiles.templatetags.staticfiles import static
else:
from django.templatetags.static import static
static = register.simple_tag(static)... | [
[
1,
0,
0.0909,
0.0909,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.1818,
0.0909,
0,
0.66,
0.25,
213,
0,
1,
0,
0,
213,
0,
0
],
[
14,
0,
0.3636,
0.0909,
0,
0... | [
"from django.conf import settings",
"from django.template import Library",
"register = Library()",
"if 'django.contrib.staticfiles' in settings.INSTALLED_APPS:\n from django.contrib.staticfiles.templatetags.staticfiles import static\nelse:\n from django.templatetags.static import static",
" from dj... |
from django import template
register = template.Library()
@register.inclusion_tag('admin/prepopulated_fields_js.html', takes_context=True)
def prepopulated_fields_js(context):
"""
Creates a list of prepopulated_fields that should render Javascript for
the prepopulated fields for both the admin form and in... | [
[
1,
0,
0.0179,
0.0179,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
14,
0,
0.0536,
0.0179,
0,
0.66,
0.25,
276,
3,
0,
0,
0,
77,
10,
1
],
[
2,
0,
0.2321,
0.2679,
0,
0... | [
"from django import template",
"register = template.Library()",
"def prepopulated_fields_js(context):\n \"\"\"\n Creates a list of prepopulated_fields that should render Javascript for\n the prepopulated fields for both the admin form and inlines.\n \"\"\"\n prepopulated_fields = []\n if conte... |
import warnings
from django.template import Library
from django.templatetags.static import PrefixNode
register = Library()
@register.simple_tag
def admin_media_prefix():
"""
Returns the string contained in the setting ADMIN_MEDIA_PREFIX.
"""
warnings.warn(
"The admin_media_prefix template tag ... | [
[
1,
0,
0.0667,
0.0667,
0,
0.66,
0,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.1333,
0.0667,
0,
0.66,
0.25,
213,
0,
1,
0,
0,
213,
0,
0
],
[
1,
0,
0.2,
0.0667,
0,
0.66,... | [
"import warnings",
"from django.template import Library",
"from django.templatetags.static import PrefixNode",
"register = Library()",
"def admin_media_prefix():\n \"\"\"\n Returns the string contained in the setting ADMIN_MEDIA_PREFIX.\n \"\"\"\n warnings.warn(\n \"The admin_media_prefix... |
from django import template
from django.contrib.admin.models import LogEntry
register = template.Library()
class AdminLogNode(template.Node):
def __init__(self, limit, varname, user):
self.limit, self.varname, self.user = limit, varname, user
def __repr__(self):
return "<GetAdminLog Node>"
... | [
[
1,
0,
0.0179,
0.0179,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0357,
0.0179,
0,
0.66,
0.25,
408,
0,
1,
0,
0,
408,
0,
0
],
[
14,
0,
0.0714,
0.0179,
0,
0... | [
"from django import template",
"from django.contrib.admin.models import LogEntry",
"register = template.Library()",
"class AdminLogNode(template.Node):\n def __init__(self, limit, varname, user):\n self.limit, self.varname, self.user = limit, varname, user\n\n def __repr__(self):\n return ... |
from django.core.urlresolvers import reverse, NoReverseMatch
from django import template
register = template.Library()
@register.filter
def admin_urlname(value, arg):
return 'admin:%s_%s_%s' % (value.app_label, value.module_name, arg)
| [
[
1,
0,
0.125,
0.125,
0,
0.66,
0,
749,
0,
2,
0,
0,
749,
0,
0
],
[
1,
0,
0.25,
0.125,
0,
0.66,
0.3333,
294,
0,
1,
0,
0,
294,
0,
0
],
[
14,
0,
0.5,
0.125,
0,
0.66,
... | [
"from django.core.urlresolvers import reverse, NoReverseMatch",
"from django import template",
"register = template.Library()",
"def admin_urlname(value, arg):\n return 'admin:%s_%s_%s' % (value.app_label, value.module_name, arg)",
" return 'admin:%s_%s_%s' % (value.app_label, value.module_name, arg)"... |
import datetime
from django.contrib.admin.util import lookup_field, display_for_field, label_for_field
from django.contrib.admin.views.main import (ALL_VAR, EMPTY_CHANGELIST_VALUE,
ORDER_VAR, PAGE_VAR, SEARCH_VAR)
from django.contrib.admin.templatetags.admin_static import static
from django.core.exceptions import ... | [
[
1,
0,
0.0026,
0.0026,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0079,
0.0026,
0,
0.66,
0.0345,
69,
0,
3,
0,
0,
69,
0,
0
],
[
1,
0,
0.0118,
0.0053,
0,
0.... | [
"import datetime",
"from django.contrib.admin.util import lookup_field, display_for_field, label_for_field",
"from django.contrib.admin.views.main import (ALL_VAR, EMPTY_CHANGELIST_VALUE,\n ORDER_VAR, PAGE_VAR, SEARCH_VAR)",
"from django.contrib.admin.templatetags.admin_static import static",
"from djang... |
#!/usr/bin/env python
import os
import optparse
import subprocess
import sys
here = os.path.dirname(__file__)
def main():
usage = "usage: %prog [file1..fileN]"
description = """With no file paths given this script will automatically
compress all jQuery-based files of the admin app. Requires the Google Closure... | [
[
1,
0,
0.0426,
0.0213,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0638,
0.0213,
0,
0.66,
0.1667,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.0851,
0.0213,
0,
... | [
"import os",
"import optparse",
"import subprocess",
"import sys",
"here = os.path.dirname(__file__)",
"def main():\n usage = \"usage: %prog [file1..fileN]\"\n description = \"\"\"With no file paths given this script will automatically\ncompress all jQuery-based files of the admin app. Requires the ... |
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.db.models.fields import FieldDoesNotExist
from django.forms.models import (BaseModelForm, BaseModelFormSet, fields_for_model,
_get_foreign_key)
from django.contrib.admin import ListFilter, FieldListFilter
from django.co... | [
[
1,
0,
0.0024,
0.0024,
0,
0.66,
0,
160,
0,
1,
0,
0,
160,
0,
0
],
[
1,
0,
0.0048,
0.0024,
0,
0.66,
0.0588,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0072,
0.0024,
0,
0.... | [
"from django.core.exceptions import ImproperlyConfigured",
"from django.db import models",
"from django.db.models.fields import FieldDoesNotExist",
"from django.forms.models import (BaseModelForm, BaseModelFormSet, fields_for_model,\n _get_foreign_key)",
"from django.contrib.admin import ListFilter, Fiel... |
from django import forms
from django.contrib.admin.util import (flatten_fieldsets, lookup_field,
display_for_field, label_for_field, help_text_for_field)
from django.contrib.admin.templatetags.admin_static import static
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import Ob... | [
[
1,
0,
0.0028,
0.0028,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0071,
0.0057,
0,
0.66,
0.0385,
69,
0,
5,
0,
0,
69,
0,
0
],
[
1,
0,
0.0114,
0.0028,
0,
0.... | [
"from django import forms",
"from django.contrib.admin.util import (flatten_fieldsets, lookup_field,\n display_for_field, label_for_field, help_text_for_field)",
"from django.contrib.admin.templatetags.admin_static import static",
"from django.contrib.contenttypes.models import ContentType",
"from django... |
from functools import update_wrapper, partial
from django import forms
from django.conf import settings
from django.forms.formsets import all_valid
from django.forms.models import (modelform_factory, modelformset_factory,
inlineformset_factory, BaseInlineFormSet)
from django.contrib.contenttypes.models import Conte... | [
[
1,
0,
0.0007,
0.0007,
0,
0.66,
0,
711,
0,
2,
0,
0,
711,
0,
0
],
[
1,
0,
0.0014,
0.0007,
0,
0.66,
0.0263,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.002,
0.0007,
0,
0... | [
"from functools import update_wrapper, partial",
"from django import forms",
"from django.conf import settings",
"from django.forms.formsets import all_valid",
"from django.forms.models import (modelform_factory, modelformset_factory,\n inlineformset_factory, BaseInlineFormSet)",
"from django.contrib.c... |
from functools import update_wrapper
from django.http import Http404, HttpResponseRedirect
from django.contrib.admin import ModelAdmin, actions
from django.contrib.admin.forms import AdminAuthenticationForm
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.contenttypes import views as contenttype_... | [
[
1,
0,
0.0023,
0.0023,
0,
0.66,
0,
711,
0,
1,
0,
0,
711,
0,
0
],
[
1,
0,
0.0045,
0.0023,
0,
0.66,
0.05,
779,
0,
2,
0,
0,
779,
0,
0
],
[
1,
0,
0.0068,
0.0023,
0,
0.... | [
"from functools import update_wrapper",
"from django.http import Http404, HttpResponseRedirect",
"from django.contrib.admin import ModelAdmin, actions",
"from django.contrib.admin.forms import AdminAuthenticationForm",
"from django.contrib.auth import REDIRECT_FIELD_NAME",
"from django.contrib.contenttype... |
"""
Form Widget classes specific to the Django admin site.
"""
import copy
from django import forms
from django.contrib.admin.templatetags.admin_static import static
from django.core.urlresolvers import reverse
from django.forms.widgets import RadioFieldRenderer
from django.forms.util import flatatt
from django.utils.... | [
[
8,
0,
0.0063,
0.0095,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0158,
0.0032,
0,
0.66,
0.037,
739,
0,
1,
0,
0,
739,
0,
0
],
[
1,
0,
0.0189,
0.0032,
0,
0.66,... | [
"\"\"\"\nForm Widget classes specific to the Django admin site.\n\"\"\"",
"import copy",
"from django import forms",
"from django.contrib.admin.templatetags.admin_static import static",
"from django.core.urlresolvers import reverse",
"from django.forms.widgets import RadioFieldRenderer",
"from django.fo... |
# ACTION_CHECKBOX_NAME is unused, but should stay since its import from here
# has been referenced in documentation.
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL
from django.contrib.admin.options import StackedInline, TabularInli... | [
[
1,
0,
0.0732,
0.0244,
0,
0.66,
0,
140,
0,
1,
0,
0,
140,
0,
0
],
[
1,
0,
0.0976,
0.0244,
0,
0.66,
0.2,
84,
0,
3,
0,
0,
84,
0,
0
],
[
1,
0,
0.122,
0.0244,
0,
0.66,
... | [
"from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME",
"from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL",
"from django.contrib.admin.options import StackedInline, TabularInline",
"from django.contrib.admin.sites import AdminSite, site",
"from django.contrib.admin.filters ... |
"""
Built-in, globally-available admin actions.
"""
from django.core.exceptions import PermissionDenied
from django.contrib.admin import helpers
from django.contrib.admin.util import get_deleted_objects, model_ngettext
from django.db import router
from django.template.response import TemplateResponse
from django.utils... | [
[
8,
0,
0.0241,
0.0361,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0602,
0.012,
0,
0.66,
0.1111,
160,
0,
1,
0,
0,
160,
0,
0
],
[
1,
0,
0.0723,
0.012,
0,
0.66,
... | [
"\"\"\"\nBuilt-in, globally-available admin actions.\n\"\"\"",
"from django.core.exceptions import PermissionDenied",
"from django.contrib.admin import helpers",
"from django.contrib.admin.util import get_deleted_objects, model_ngettext",
"from django.db import router",
"from django.template.response impo... |
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import zipfile
from django.conf import settings
from django.http import HttpResponse
from django.template import loader
def compress_kml(kml):
"Returns compressed KMZ from the given KML string."
kmz = StringIO()
... | [
[
7,
0,
0.0694,
0.1111,
0,
0.66,
0,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.0556,
0.0278,
1,
0.94,
0,
764,
0,
1,
0,
0,
764,
0,
0
],
[
1,
1,
0.1111,
0.0278,
1,
0.94,
... | [
"try:\n from cStringIO import StringIO\nexcept ImportError:\n from StringIO import StringIO",
" from cStringIO import StringIO",
" from StringIO import StringIO",
"import zipfile",
"from django.conf import settings",
"from django.http import HttpResponse",
"from django.template import loader... |
from django.db import connection
if (hasattr(connection.ops, 'spatial_version') and
not connection.ops.mysql):
# Getting the `SpatialRefSys` and `GeometryColumns`
# models for the default spatial backend. These
# aliases are provided for backwards-compatibility.
SpatialRefSys = connection.ops.spat... | [
[
1,
0,
0.1111,
0.1111,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
4,
0,
0.6667,
0.7778,
0,
0.66,
1,
0,
0,
0,
0,
0,
0,
0,
3
],
[
14,
1,
0.8889,
0.1111,
1,
0.78,
... | [
"from django.db import connection",
"if (hasattr(connection.ops, 'spatial_version') and\n not connection.ops.mysql):\n # Getting the `SpatialRefSys` and `GeometryColumns`\n # models for the default spatial backend. These\n # aliases are provided for backwards-compatibility.\n SpatialRefSys = conne... |
from django.core import urlresolvers
from django.contrib.sitemaps import Sitemap
class GeoRSSSitemap(Sitemap):
"""
A minimal hook to produce sitemaps for GeoRSS feeds.
"""
def __init__(self, feed_dict, slug_dict=None):
"""
This sitemap object initializes on a feed dictionary (as would b... | [
[
1,
0,
0.0189,
0.0189,
0,
0.66,
0,
913,
0,
1,
0,
0,
913,
0,
0
],
[
1,
0,
0.0377,
0.0189,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
3,
0,
0.5283,
0.9245,
0,
0.6... | [
"from django.core import urlresolvers",
"from django.contrib.sitemaps import Sitemap",
"class GeoRSSSitemap(Sitemap):\n \"\"\"\n A minimal hook to produce sitemaps for GeoRSS feeds.\n \"\"\"\n def __init__(self, feed_dict, slug_dict=None):\n \"\"\"\n This sitemap object initializes on ... |
from django.core import urlresolvers
from django.contrib.sitemaps import Sitemap
from django.contrib.gis.db.models.fields import GeometryField
from django.db import models
class KMLSitemap(Sitemap):
"""
A minimal hook to produce KML sitemaps.
"""
geo_format = 'kml'
def __init__(self, locations=Non... | [
[
1,
0,
0.0159,
0.0159,
0,
0.66,
0,
913,
0,
1,
0,
0,
913,
0,
0
],
[
1,
0,
0.0317,
0.0159,
0,
0.66,
0.2,
890,
0,
1,
0,
0,
890,
0,
0
],
[
1,
0,
0.0476,
0.0159,
0,
0.6... | [
"from django.core import urlresolvers",
"from django.contrib.sitemaps import Sitemap",
"from django.contrib.gis.db.models.fields import GeometryField",
"from django.db import models",
"class KMLSitemap(Sitemap):\n \"\"\"\n A minimal hook to produce KML sitemaps.\n \"\"\"\n geo_format = 'kml'\n\n... |
from django.http import HttpResponse, Http404
from django.template import loader
from django.contrib.sites.models import get_current_site
from django.core import urlresolvers
from django.core.paginator import EmptyPage, PageNotAnInteger
from django.contrib.gis.db.models.fields import GeometryField
from django.db import... | [
[
1,
0,
0.0089,
0.0089,
0,
0.66,
0,
779,
0,
2,
0,
0,
779,
0,
0
],
[
1,
0,
0.0179,
0.0089,
0,
0.66,
0.0714,
213,
0,
1,
0,
0,
213,
0,
0
],
[
1,
0,
0.0268,
0.0089,
0,
... | [
"from django.http import HttpResponse, Http404",
"from django.template import loader",
"from django.contrib.sites.models import get_current_site",
"from django.core import urlresolvers",
"from django.core.paginator import EmptyPage, PageNotAnInteger",
"from django.contrib.gis.db.models.fields import Geome... |
# Geo-enabled Sitemap classes.
from django.contrib.gis.sitemaps.georss import GeoRSSSitemap
from django.contrib.gis.sitemaps.kml import KMLSitemap, KMZSitemap
| [
[
1,
0,
0.5,
0.25,
0,
0.66,
0,
81,
0,
1,
0,
0,
81,
0,
0
],
[
1,
0,
0.75,
0.25,
0,
0.66,
1,
933,
0,
2,
0,
0,
933,
0,
0
]
] | [
"from django.contrib.gis.sitemaps.georss import GeoRSSSitemap",
"from django.contrib.gis.sitemaps.kml import KMLSitemap, KMZSitemap"
] |
from django.contrib.gis.geos import (
GEOSGeometry as Geometry, GEOSException as GeometryException)
| [
[
1,
0,
0.75,
1,
0,
0.66,
0,
886,
0,
2,
0,
0,
886,
0,
0
]
] | [
"from django.contrib.gis.geos import (\n GEOSGeometry as Geometry, GEOSException as GeometryException)"
] |
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
geom_backend = getattr(settings, 'GEOMETRY_BACKEND', 'geos')
try:
module = import_module('.%s' % geom_backend, 'django.contrib.gis.geometry.backend')
except ImportError, e:
... | [
[
1,
0,
0.25,
0.25,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.5,
0.25,
0,
0.66,
0.5,
160,
0,
1,
0,
0,
160,
0,
0
],
[
1,
0,
0.75,
0.25,
0,
0.66,
1,
... | [
"from django.conf import settings",
"from django.core.exceptions import ImproperlyConfigured",
"from django.utils.importlib import import_module"
] |
import re
# Regular expression for recognizing HEXEWKB and WKT. A prophylactic measure
# to prevent potentially malicious input from reaching the underlying C
# library. Not a substitute for good Web security programming practices.
hex_regex = re.compile(r'^[0-9A-F]+$', re.I)
wkt_regex = re.compile(r'^(SRID=(?P<srid... | [
[
1,
0,
0.0833,
0.0833,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
14,
0,
0.5,
0.0833,
0,
0.66,
0.3333,
439,
3,
2,
0,
0,
821,
10,
1
],
[
14,
0,
0.75,
0.4167,
0,
0.... | [
"import re",
"hex_regex = re.compile(r'^[0-9A-F]+$', re.I)",
"wkt_regex = re.compile(r'^(SRID=(?P<srid>\\-?\\d+);)?'\n r'(?P<wkt>'\n r'(?P<type>POINT|LINESTRING|LINEARRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON|GEOMETRYCOLLECTION)'\n r'[... |
from django.contrib.gis.geos import GEOSGeometry, LinearRing, Polygon, Point
from django.contrib.gis.maps.google.gmap import GoogleMapException
from math import pi, sin, log, exp, atan
# Constants used for degree to radian conversion, and vice-versa.
DTOR = pi / 180.
RTOD = 180. / pi
class GoogleZoom(object):
"""... | [
[
1,
0,
0.0062,
0.0062,
0,
0.66,
0,
886,
0,
4,
0,
0,
886,
0,
0
],
[
1,
0,
0.0124,
0.0062,
0,
0.66,
0.2,
633,
0,
1,
0,
0,
633,
0,
0
],
[
1,
0,
0.0186,
0.0062,
0,
0.6... | [
"from django.contrib.gis.geos import GEOSGeometry, LinearRing, Polygon, Point",
"from django.contrib.gis.maps.google.gmap import GoogleMapException",
"from math import pi, sin, log, exp, atan",
"DTOR = pi / 180.",
"RTOD = 180. / pi",
"class GoogleZoom(object):\n \"\"\"\n GoogleZoom is a utility for ... |
from django.utils.safestring import mark_safe
from django.contrib.gis.geos import fromstr, Point, LineString, LinearRing, Polygon
class GEvent(object):
"""
A Python wrapper for the Google GEvent object.
Events can be attached to any object derived from GOverlayBase with the
add_event() call.
For ... | [
[
1,
0,
0.0033,
0.0033,
0,
0.66,
0,
375,
0,
1,
0,
0,
375,
0,
0
],
[
1,
0,
0.0066,
0.0033,
0,
0.66,
0.1429,
886,
0,
5,
0,
0,
886,
0,
0
],
[
3,
0,
0.0897,
0.1561,
0,
... | [
"from django.utils.safestring import mark_safe",
"from django.contrib.gis.geos import fromstr, Point, LineString, LinearRing, Polygon",
"class GEvent(object):\n \"\"\"\n A Python wrapper for the Google GEvent object.\n\n Events can be attached to any object derived from GOverlayBase with the\n add_e... |
"""
This module houses the GoogleMap object, used for generating
the needed javascript to embed Google Maps in a Web page.
Google(R) is a registered trademark of Google, Inc. of Mountain View, California.
Example:
* In the view:
return render_to_response('template.html', {'google' : GoogleMap(key="... | [
[
8,
0,
0.4836,
0.9508,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.9672,
0.0164,
0,
0.66,
0.3333,
633,
0,
2,
0,
0,
633,
0,
0
],
[
1,
0,
0.9836,
0.0164,
0,
0.66... | [
"\"\"\"\n This module houses the GoogleMap object, used for generating\n the needed javascript to embed Google Maps in a Web page.\n\n Google(R) is a registered trademark of Google, Inc. of Mountain View, California.\n\n Example:",
"from django.contrib.gis.maps.google.gmap import GoogleMap, GoogleMapSet",
... |
from django.conf import settings
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
from django.contrib.gis.maps.google.overlays import GPolygon, GPolyline, GMarker
class GoogleMapException(Exception):
pass
# The default Google Maps URL (for the API javascript)
# T... | [
[
1,
0,
0.0044,
0.0044,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0087,
0.0044,
0,
0.66,
0.1429,
970,
0,
1,
0,
0,
970,
0,
0
],
[
1,
0,
0.0131,
0.0044,
0,
... | [
"from django.conf import settings",
"from django.template.loader import render_to_string",
"from django.utils.safestring import mark_safe",
"from django.contrib.gis.maps.google.overlays import GPolygon, GPolyline, GMarker",
"class GoogleMapException(Exception):\n pass",
"GOOGLE_MAPS_URL='http://maps.go... |
from django.contrib.syndication.views import Feed as BaseFeed
from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
class GeoFeedMixin(object):
"""
This mixin provides the necessary routines for SyndicationFeed subclasses
to produce simple GeoRSS or W3C Geo elements.
"""
def georss_coor... | [
[
1,
0,
0.0074,
0.0074,
0,
0.66,
0,
264,
0,
1,
0,
0,
264,
0,
0
],
[
1,
0,
0.0148,
0.0074,
0,
0.66,
0.1667,
366,
0,
2,
0,
0,
366,
0,
0
],
[
3,
0,
0.2963,
0.5407,
0,
... | [
"from django.contrib.syndication.views import Feed as BaseFeed",
"from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed",
"class GeoFeedMixin(object):\n \"\"\"\n This mixin provides the necessary routines for SyndicationFeed subclasses\n to produce simple GeoRSS or W3C Geo elements.\n \"\... |
"""
Utilities for manipulating Geometry WKT.
"""
def precision_wkt(geom, prec):
"""
Returns WKT text of the geometry according to the given precision (an
integer or a string). If the precision is an integer, then the decimal
places of coordinates WKT will be truncated to that number:
>>> pnt =... | [
[
8,
0,
0.0364,
0.0545,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.5455,
0.9273,
0,
0.66,
1,
39,
0,
2,
1,
0,
0,
0,
19
],
[
8,
1,
0.2273,
0.2545,
1,
0.82,
0... | [
"\"\"\"\n Utilities for manipulating Geometry WKT.\n\"\"\"",
"def precision_wkt(geom, prec):\n \"\"\"\n Returns WKT text of the geometry according to the given precision (an \n integer or a string). If the precision is an integer, then the decimal\n places of coordinates WKT will be truncated to that... |
import warnings
from django.contrib.gis import geoip
HAS_GEOIP = geoip.HAS_GEOIP
if HAS_GEOIP:
BaseGeoIP = geoip.GeoIP
GeoIPException = geoip.GeoIPException
class GeoIP(BaseGeoIP):
def __init__(self, *args, **kwargs):
warnings.warn('GeoIP class has been moved to `django.contrib.gis.geo... | [
[
1,
0,
0.0714,
0.0714,
0,
0.66,
0,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.2143,
0.0714,
0,
0.66,
0.3333,
735,
0,
1,
0,
0,
735,
0,
0
],
[
14,
0,
0.2857,
0.0714,
0,
... | [
"import warnings",
"from django.contrib.gis import geoip",
"HAS_GEOIP = geoip.HAS_GEOIP",
"if HAS_GEOIP:\n BaseGeoIP = geoip.GeoIP\n GeoIPException = geoip.GeoIPException\n\n class GeoIP(BaseGeoIP):\n def __init__(self, *args, **kwargs):\n warnings.warn('GeoIP class has been moved t... |
"""
This module is for inspecting OGR data sources and generating either
models for GeoDjango and/or mapping dictionaries for use with the
`LayerMapping` utility.
Author: Travis Pinney, Dane Springmeyer, & Justin Bronn
"""
from itertools import izip
# Requires GDAL to use.
from django.contrib.gis.gdal import DataSourc... | [
[
8,
0,
0.0178,
0.0311,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0356,
0.0044,
0,
0.66,
0.1667,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.0444,
0.0044,
0,
0.66... | [
"\"\"\"\nThis module is for inspecting OGR data sources and generating either\nmodels for GeoDjango and/or mapping dictionaries for use with the\n`LayerMapping` utility.\n\nAuthor: Travis Pinney, Dane Springmeyer, & Justin Bronn\n\"\"\"",
"from itertools import izip",
"from django.contrib.gis.gdal import DataSo... |
"""
This module includes some utility functions for inspecting the layout
of a GDAL data source -- the functionality is analogous to the output
produced by the `ogrinfo` utility.
"""
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.gdal.geometries import GEO_CLASSES
def ogrinfo(data_source, num_... | [
[
8,
0,
0.0566,
0.0943,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1321,
0.0189,
0,
0.66,
0.25,
793,
0,
1,
0,
0,
793,
0,
0
],
[
1,
0,
0.1509,
0.0189,
0,
0.66,
... | [
"\"\"\"\nThis module includes some utility functions for inspecting the layout\nof a GDAL data source -- the functionality is analogous to the output\nproduced by the `ogrinfo` utility.\n\"\"\"",
"from django.contrib.gis.gdal import DataSource",
"from django.contrib.gis.gdal.geometries import GEO_CLASSES",
"d... |
"""
This module contains useful utilities for GeoDjango.
"""
# Importing the utilities that depend on GDAL, if available.
from django.contrib.gis.gdal import HAS_GDAL
if HAS_GDAL:
from django.contrib.gis.utils.ogrinfo import ogrinfo, sample
from django.contrib.gis.utils.ogrinspect import mapping, ogrinspect
... | [
[
8,
0,
0.08,
0.12,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2,
0.04,
0,
0.66,
0.1667,
793,
0,
1,
0,
0,
793,
0,
0
],
[
4,
0,
0.42,
0.4,
0,
0.66,
0.3333,
... | [
"\"\"\"\n This module contains useful utilities for GeoDjango.\n\"\"\"",
"from django.contrib.gis.gdal import HAS_GDAL",
"if HAS_GDAL:\n from django.contrib.gis.utils.ogrinfo import ogrinfo, sample\n from django.contrib.gis.utils.ogrinspect import mapping, ogrinspect\n from django.contrib.gis.utils.srs... |
from django.contrib.gis.gdal import SpatialReference
def add_srs_entry(srs, auth_name='EPSG', auth_srid=None, ref_sys_name=None,
database=None):
"""
This function takes a GDAL SpatialReference system and adds its information
to the `spatial_ref_sys` table of the spatial backend. Doing th... | [
[
1,
0,
0.0125,
0.0125,
0,
0.66,
0,
793,
0,
1,
0,
0,
793,
0,
0
],
[
2,
0,
0.5,
0.9375,
0,
0.66,
0.5,
461,
0,
5,
0,
0,
0,
0,
11
],
[
8,
1,
0.2437,
0.375,
1,
0.63,
... | [
"from django.contrib.gis.gdal import SpatialReference",
"def add_srs_entry(srs, auth_name='EPSG', auth_srid=None, ref_sys_name=None,\n database=None):\n \"\"\"\n This function takes a GDAL SpatialReference system and adds its information\n to the `spatial_ref_sys` table of the spatial ba... |
from __future__ import absolute_import
from django.contrib.gis.sitemaps import GeoRSSSitemap, KMLSitemap, KMZSitemap
from .feeds import feed_dict
from .models import City, Country
sitemaps = {'kml' : KMLSitemap([City, Country]),
'kmz' : KMZSitemap([City, Country]),
'georss' : GeoRSSSitemap(f... | [
[
1,
0,
0.0833,
0.0833,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.25,
0.0833,
0,
0.66,
0.25,
123,
0,
3,
0,
0,
123,
0,
0
],
[
1,
0,
0.4167,
0.0833,
0,
0.66... | [
"from __future__ import absolute_import",
"from django.contrib.gis.sitemaps import GeoRSSSitemap, KMLSitemap, KMZSitemap",
"from .feeds import feed_dict",
"from .models import City, Country",
"sitemaps = {'kml' : KMLSitemap([City, Country]),\n 'kmz' : KMZSitemap([City, Country]),\n 'ge... |
from django.contrib.gis.db import models
from django.contrib.gis.tests.utils import mysql, spatialite
# MySQL spatial indices can't handle NULL geometries.
null_flag = not mysql
class Country(models.Model):
name = models.CharField(max_length=30)
mpoly = models.MultiPolygonField() # SRID, by default, is 4326
... | [
[
1,
0,
0.02,
0.02,
0,
0.66,
0,
964,
0,
1,
0,
0,
964,
0,
0
],
[
1,
0,
0.04,
0.02,
0,
0.66,
0.1111,
185,
0,
2,
0,
0,
185,
0,
0
],
[
14,
0,
0.1,
0.02,
0,
0.66,
0.... | [
"from django.contrib.gis.db import models",
"from django.contrib.gis.tests.utils import mysql, spatialite",
"null_flag = not mysql",
"class Country(models.Model):\n name = models.CharField(max_length=30)\n mpoly = models.MultiPolygonField() # SRID, by default, is 4326\n objects = models.GeoManager()\... |
from __future__ import absolute_import
import re
from django.db import connection
from django.db.utils import DatabaseError
from django.contrib.gis import gdal
from django.contrib.gis.geos import (fromstr, GEOSGeometry,
Point, LineString, LinearRing, Polygon, GeometryCollection)
from django.contrib.gis.tests.util... | [
[
1,
0,
0.0013,
0.0013,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.004,
0.0013,
0,
0.66,
0.0769,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0067,
0.0013,
0,
0... | [
"from __future__ import absolute_import",
"import re",
"from django.db import connection",
"from django.db.utils import DatabaseError",
"from django.contrib.gis import gdal",
"from django.contrib.gis.geos import (fromstr, GEOSGeometry,\n Point, LineString, LinearRing, Polygon, GeometryCollection)",
"... |
from __future__ import absolute_import
from django.contrib.gis import feeds
from .models import City
class TestGeoRSS1(feeds.Feed):
link = '/city/'
title = 'Test GeoDjango Cities'
def items(self):
return City.objects.all()
def item_link(self, item):
return '/city/%s/' % item.pk
... | [
[
1,
0,
0.0152,
0.0152,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0455,
0.0152,
0,
0.66,
0.1,
735,
0,
1,
0,
0,
735,
0,
0
],
[
1,
0,
0.0758,
0.0152,
0,
0.6... | [
"from __future__ import absolute_import",
"from django.contrib.gis import feeds",
"from .models import City",
"class TestGeoRSS1(feeds.Feed):\n link = '/city/'\n title = 'Test GeoDjango Cities'\n\n def items(self):\n return City.objects.all()\n\n def item_link(self, item):",
" link = '... |
from __future__ import absolute_import
from django.conf.urls import patterns
from .feeds import feed_dict
from .sitemaps import sitemaps
urlpatterns = patterns('',
(r'^feeds/(?P<url>.*)/$', 'django.contrib.gis.views.feed', {'feed_dict': feed_dict}),
)
urlpatterns += patterns('django.contrib.gis.sitemaps.views'... | [
[
1,
0,
0.0556,
0.0556,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.1667,
0.0556,
0,
0.66,
0.25,
528,
0,
1,
0,
0,
528,
0,
0
],
[
1,
0,
0.2778,
0.0556,
0,
0.... | [
"from __future__ import absolute_import",
"from django.conf.urls import patterns",
"from .feeds import feed_dict",
"from .sitemaps import sitemaps",
"urlpatterns = patterns('',\n (r'^feeds/(?P<url>.*)/$', 'django.contrib.gis.views.feed', {'feed_dict': feed_dict}),\n)"
] |
from django.contrib.gis.db import models
class City3D(models.Model):
name = models.CharField(max_length=30)
point = models.PointField(dim=3)
objects = models.GeoManager()
def __unicode__(self):
return self.name
class Interstate2D(models.Model):
name = models.CharField(max_length=30)
l... | [
[
1,
0,
0.0145,
0.0145,
0,
0.66,
0,
964,
0,
1,
0,
0,
964,
0,
0
],
[
3,
0,
0.087,
0.1014,
0,
0.66,
0.1,
877,
0,
1,
0,
0,
996,
0,
3
],
[
14,
1,
0.058,
0.0145,
1,
0.5,... | [
"from django.contrib.gis.db import models",
"class City3D(models.Model):\n name = models.CharField(max_length=30)\n point = models.PointField(dim=3)\n objects = models.GeoManager()\n\n def __unicode__(self):\n return self.name",
" name = models.CharField(max_length=30)",
" point = mod... |
from __future__ import absolute_import
import os
import re
from django.utils.unittest import TestCase
from django.contrib.gis.db.models import Union, Extent3D
from django.contrib.gis.geos import GEOSGeometry, Point, Polygon
from django.contrib.gis.utils import LayerMapping, LayerMapError
from .models import (City3D,... | [
[
1,
0,
0.0043,
0.0043,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0129,
0.0043,
0,
0.66,
0.0588,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0172,
0.0043,
0,
... | [
"from __future__ import absolute_import",
"import os",
"import re",
"from django.utils.unittest import TestCase",
"from django.contrib.gis.db.models import Union, Extent3D",
"from django.contrib.gis.geos import GEOSGeometry, Point, Polygon",
"from django.contrib.gis.utils import LayerMapping, LayerMapEr... |
# Create your views here.
| [] | [] |
from django.contrib.gis.db import models
class SouthTexasCity(models.Model):
"City model on projected coordinate system for South Texas."
name = models.CharField(max_length=30)
point = models.PointField(srid=32140)
objects = models.GeoManager()
def __unicode__(self): return self.name
class SouthTe... | [
[
1,
0,
0.02,
0.02,
0,
0.66,
0,
964,
0,
1,
0,
0,
964,
0,
0
],
[
3,
0,
0.11,
0.12,
0,
0.66,
0.1429,
516,
0,
1,
0,
0,
996,
0,
3
],
[
8,
1,
0.08,
0.02,
1,
0.49,
0,... | [
"from django.contrib.gis.db import models",
"class SouthTexasCity(models.Model):\n \"City model on projected coordinate system for South Texas.\"\n name = models.CharField(max_length=30)\n point = models.PointField(srid=32140)\n objects = models.GeoManager()\n def __unicode__(self): return self.nam... |
from __future__ import absolute_import
from django.db import connection
from django.db.models import Q
from django.contrib.gis.geos import GEOSGeometry, LineString
from django.contrib.gis.measure import D # alias for Distance
from django.contrib.gis.tests.utils import oracle, postgis, spatialite, no_oracle, no_spatial... | [
[
1,
0,
0.0028,
0.0028,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0084,
0.0028,
0,
0.66,
0.125,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0112,
0.0028,
0,
0.6... | [
"from __future__ import absolute_import",
"from django.db import connection",
"from django.db.models import Q",
"from django.contrib.gis.geos import GEOSGeometry, LineString",
"from django.contrib.gis.measure import D # alias for Distance",
"from django.contrib.gis.tests.utils import oracle, postgis, spat... |
from django.contrib.gis.db import models
class City(models.Model):
name = models.CharField(max_length=30)
point = models.PointField(geography=True)
objects = models.GeoManager()
def __unicode__(self): return self.name
class Zipcode(models.Model):
code = models.CharField(max_length=10)
poly = m... | [
[
1,
0,
0.05,
0.05,
0,
0.66,
0,
964,
0,
1,
0,
0,
964,
0,
0
],
[
3,
0,
0.25,
0.25,
0,
0.66,
0.3333,
801,
0,
1,
0,
0,
996,
0,
3
],
[
14,
1,
0.2,
0.05,
1,
0.67,
0,... | [
"from django.contrib.gis.db import models",
"class City(models.Model):\n name = models.CharField(max_length=30)\n point = models.PointField(geography=True)\n objects = models.GeoManager()\n def __unicode__(self): return self.name",
" name = models.CharField(max_length=30)",
" point = models.... |
"""
Tests for geography support in PostGIS 1.5+
"""
from __future__ import absolute_import
import os
from django.contrib.gis import gdal
from django.contrib.gis.measure import D
from django.test import TestCase
from .models import City, County, Zipcode
class GeographyTest(TestCase):
def test01_fixture_load(se... | [
[
8,
0,
0.022,
0.033,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.044,
0.011,
0,
0.66,
0.1429,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0659,
0.011,
0,
0.66,
... | [
"\"\"\"\nTests for geography support in PostGIS 1.5+\n\"\"\"",
"from __future__ import absolute_import",
"import os",
"from django.contrib.gis import gdal",
"from django.contrib.gis.measure import D",
"from django.test import TestCase",
"from .models import City, County, Zipcode",
"class GeographyTest... |
from django.contrib.gis.db import models
class State(models.Model):
name = models.CharField(max_length=20)
objects = models.GeoManager()
class County(models.Model):
name = models.CharField(max_length=25)
state = models.ForeignKey(State)
mpoly = models.MultiPolygonField(srid=4269) # Multipolygon in... | [
[
1,
0,
0.0145,
0.0145,
0,
0.66,
0,
964,
0,
1,
0,
0,
964,
0,
0
],
[
3,
0,
0.058,
0.0435,
0,
0.66,
0.0769,
110,
0,
0,
0,
0,
996,
0,
2
],
[
14,
1,
0.058,
0.0145,
1,
0... | [
"from django.contrib.gis.db import models",
"class State(models.Model):\n name = models.CharField(max_length=20)\n objects = models.GeoManager()",
" name = models.CharField(max_length=20)",
" objects = models.GeoManager()",
"class County(models.Model):\n name = models.CharField(max_length=25)... |
from __future__ import absolute_import
import os
from copy import copy
from decimal import Decimal
from django.utils.unittest import TestCase
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.tests.utils import mysql
from django.contrib.gis.utils.layermapping import LayerMapping, LayerMapError, ... | [
[
1,
0,
0.0036,
0.0036,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0107,
0.0036,
0,
0.66,
0.0588,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0143,
0.0036,
0,
... | [
"from __future__ import absolute_import",
"import os",
"from copy import copy",
"from decimal import Decimal",
"from django.utils.unittest import TestCase",
"from django.contrib.gis.gdal import DataSource",
"from django.contrib.gis.tests.utils import mysql",
"from django.contrib.gis.utils.layermapping... |
from django.contrib.gis.db import models
from django.contrib.localflavor.us.models import USStateField
class Location(models.Model):
point = models.PointField()
objects = models.GeoManager()
def __unicode__(self): return self.point.wkt
class City(models.Model):
name = models.CharField(max_length=50)
... | [
[
1,
0,
0.02,
0.02,
0,
0.66,
0,
964,
0,
1,
0,
0,
964,
0,
0
],
[
1,
0,
0.04,
0.02,
0,
0.66,
0.1111,
676,
0,
1,
0,
0,
676,
0,
0
],
[
3,
0,
0.11,
0.08,
0,
0.66,
0.... | [
"from django.contrib.gis.db import models",
"from django.contrib.localflavor.us.models import USStateField",
"class Location(models.Model):\n point = models.PointField()\n objects = models.GeoManager()\n def __unicode__(self): return self.point.wkt",
" point = models.PointField()",
" objects ... |
from __future__ import absolute_import
from datetime import date
from django.contrib.gis.geos import GEOSGeometry, Point, MultiPoint
from django.contrib.gis.db.models import Collect, Count, Extent, F, Union
from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.tests.utils import mysql, orac... | [
[
1,
0,
0.0033,
0.0033,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0099,
0.0033,
0,
0.66,
0.125,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0166,
0.0033,
0,
0... | [
"from __future__ import absolute_import",
"from datetime import date",
"from django.contrib.gis.geos import GEOSGeometry, Point, MultiPoint",
"from django.contrib.gis.db.models import Collect, Count, Extent, F, Union",
"from django.contrib.gis.geometry.backend import Geometry",
"from django.contrib.gis.te... |
from django.conf import settings
from django.db import DEFAULT_DB_ALIAS
# function that will pass a test.
def pass_test(*args): return
def no_backend(test_func, backend):
"Use this decorator to disable test on specified backend."
if settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'].rsplit('.')[-1] == backend:
... | [
[
1,
0,
0.0385,
0.0385,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0769,
0.0385,
0,
0.66,
0.0833,
40,
0,
1,
0,
0,
40,
0,
0
],
[
2,
0,
0.1923,
0.0385,
0,
0.... | [
"from django.conf import settings",
"from django.db import DEFAULT_DB_ALIAS",
"def pass_test(*args): return",
"def pass_test(*args): return",
"def no_backend(test_func, backend):\n \"Use this decorator to disable test on specified backend.\"\n if settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'].rsplit('... |
from django.contrib.gis.db import models
class AllOGRFields(models.Model):
f_decimal = models.FloatField()
f_float = models.FloatField()
f_int = models.IntegerField()
f_char = models.CharField(max_length=10)
f_date = models.DateField()
f_datetime = models.DateTimeField()
f_time = models.Tim... | [
[
1,
0,
0.0769,
0.0769,
0,
0.66,
0,
964,
0,
1,
0,
0,
964,
0,
0
],
[
3,
0,
0.6154,
0.8462,
0,
0.66,
1,
128,
0,
0,
0,
0,
996,
0,
9
],
[
14,
1,
0.3077,
0.0769,
1,
0.96... | [
"from django.contrib.gis.db import models",
"class AllOGRFields(models.Model):\n f_decimal = models.FloatField()\n f_float = models.FloatField()\n f_int = models.IntegerField()\n f_char = models.CharField(max_length=10)\n f_date = models.DateField()\n f_datetime = models.DateTimeField()\n f_t... |
from __future__ import absolute_import
import os
from django.db import connections
from django.test import TestCase
from django.contrib.gis.gdal import Driver
from django.contrib.gis.geometry.test_data import TEST_DATA
from django.contrib.gis.utils.ogrinspect import ogrinspect
from .models import AllOGRFields
clas... | [
[
1,
0,
0.0079,
0.0079,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0238,
0.0079,
0,
0.66,
0.1111,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0397,
0.0079,
0,
... | [
"from __future__ import absolute_import",
"import os",
"from django.db import connections",
"from django.test import TestCase",
"from django.contrib.gis.gdal import Driver",
"from django.contrib.gis.geometry.test_data import TEST_DATA",
"from django.contrib.gis.utils.ogrinspect import ogrinspect",
"fr... |
from django.contrib.gis.db import models
from django.contrib.gis import admin
class City(models.Model):
name = models.CharField(max_length=30)
point = models.PointField()
objects = models.GeoManager()
def __unicode__(self): return self.name
admin.site.register(City, admin.OSMGeoAdmin)
| [
[
1,
0,
0.1,
0.1,
0,
0.66,
0,
964,
0,
1,
0,
0,
964,
0,
0
],
[
1,
0,
0.2,
0.1,
0,
0.66,
0.3333,
735,
0,
1,
0,
0,
735,
0,
0
],
[
3,
0,
0.6,
0.5,
0,
0.66,
0.6667,
... | [
"from django.contrib.gis.db import models",
"from django.contrib.gis import admin",
"class City(models.Model):\n name = models.CharField(max_length=30)\n point = models.PointField()\n objects = models.GeoManager()\n def __unicode__(self): return self.name",
" name = models.CharField(max_length=... |
from __future__ import absolute_import
from django.test import TestCase
from django.contrib.gis import admin
from .models import City
class GeoAdminTest(TestCase):
urls = 'django.contrib.gis.tests.geoadmin.urls'
def test01_ensure_geographic_media(self):
geoadmin = admin.site._registry[City]
... | [
[
1,
0,
0.0625,
0.0625,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.1875,
0.0625,
0,
0.66,
0.25,
944,
0,
1,
0,
0,
944,
0,
0
],
[
1,
0,
0.25,
0.0625,
0,
0.66... | [
"from __future__ import absolute_import",
"from django.test import TestCase",
"from django.contrib.gis import admin",
"from .models import City",
"class GeoAdminTest(TestCase):\n urls = 'django.contrib.gis.tests.geoadmin.urls'\n\n def test01_ensure_geographic_media(self):\n geoadmin = admin.sit... |
from django.conf.urls import patterns, include
from django.contrib import admin
urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),
)
| [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
528,
0,
2,
0,
0,
528,
0,
0
],
[
1,
0,
0.3333,
0.1667,
0,
0.66,
0.5,
302,
0,
1,
0,
0,
302,
0,
0
],
[
14,
0,
0.8333,
0.5,
0,
0.66,... | [
"from django.conf.urls import patterns, include",
"from django.contrib import admin",
"urlpatterns = patterns('',\n (r'^admin/', include(admin.site.urls)),\n)"
] |
from django.conf import settings
from django.test.simple import build_suite, DjangoTestSuiteRunner
from django.utils import unittest
def run_tests(*args, **kwargs):
from django.test.simple import run_tests as base_run_tests
return base_run_tests(*args, **kwargs)
def geo_apps(namespace=True, runtests=False):
... | [
[
1,
0,
0.0076,
0.0076,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0153,
0.0076,
0,
0.66,
0.1667,
655,
0,
2,
0,
0,
655,
0,
0
],
[
1,
0,
0.0229,
0.0076,
0,
... | [
"from django.conf import settings",
"from django.test.simple import build_suite, DjangoTestSuiteRunner",
"from django.utils import unittest",
"def run_tests(*args, **kwargs):\n from django.test.simple import run_tests as base_run_tests\n return base_run_tests(*args, **kwargs)",
" from django.test.s... |
# Copyright (c) 2007, Robert Coup <robert.coup@onetrackmind.co.nz>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
#... | [
[
8,
0,
0.0982,
0.0268,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1131,
0.003,
0,
0.66,
0.1429,
272,
0,
0,
0,
0,
0,
5,
0
],
[
1,
0,
0.1161,
0.003,
0,
0.66,
... | [
"\"\"\"\nDistance and Area objects to allow for sensible and convienient calculation\nand conversions.\n\nAuthors: Robert Coup, Justin Bronn\n\nInspired by GeoPy (http://exogen.case.edu/projects/geopy/)\nand Geoff Biggs' PhD work on dimensioned units for robotics.",
"__all__ = ['A', 'Area', 'D', 'Distance']",
"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.