code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
"""
A generic comment-moderation system which allows configuration of
moderation options on a per-model basis.
To use, do two things:
1. Create or import a subclass of ``CommentModerator`` defining the
options you want.
2. Import ``moderator`` from this module and register one or more
models, passing... | [
[
8,
0,
0.0789,
0.1549,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1606,
0.0028,
0,
0.66,
0.0769,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.1662,
0.0028,
0,
0.66... | [
"\"\"\"\nA generic comment-moderation system which allows configuration of\nmoderation options on a per-model basis.\n\nTo use, do two things:\n\n1. Create or import a subclass of ``CommentModerator`` defining the\n options you want.",
"import datetime",
"from django.conf import settings",
"from django.core... |
"""
Signals relating to comments.
"""
from django.dispatch import Signal
# Sent just before a comment will be posted (after it's been approved and
# moderated; this can be used to modify the comment (in place) with posting
# details or other such actions. If any receiver returns False the comment will be
# dis... | [
[
8,
0,
0.0952,
0.1429,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1905,
0.0476,
0,
0.66,
0.25,
548,
0,
1,
0,
0,
548,
0,
0
],
[
14,
0,
0.5714,
0.0476,
0,
0.66,... | [
"\"\"\"\nSignals relating to comments.\n\"\"\"",
"from django.dispatch import Signal",
"comment_will_be_posted = Signal(providing_args=[\"comment\", \"request\"])",
"comment_was_posted = Signal(providing_args=[\"comment\", \"request\"])",
"comment_was_flagged = Signal(providing_args=[\"comment\", \"flag\", ... |
from django.conf import settings
from django.contrib.syndication.views import Feed
from django.contrib.sites.models import Site
from django.contrib import comments
from django.utils.translation import ugettext as _
class LatestCommentFeed(Feed):
"""Feed of latest comments on the current site."""
def ... | [
[
1,
0,
0.0263,
0.0263,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0526,
0.0263,
0,
0.66,
0.2,
264,
0,
1,
0,
0,
264,
0,
0
],
[
1,
0,
0.0789,
0.0263,
0,
0.6... | [
"from django.conf import settings",
"from django.contrib.syndication.views import Feed",
"from django.contrib.sites.models import Site",
"from django.contrib import comments",
"from django.utils.translation import ugettext as _",
"class LatestCommentFeed(Feed):\n \"\"\"Feed of latest comments on the cu... |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import force_unicode
class CommentManager(models.Manager):
def in_moderation(self):
"""
QuerySet for all comments currently in the moderation queue.
"""
retu... | [
[
1,
0,
0.0455,
0.0455,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0909,
0.0455,
0,
0.66,
0.3333,
469,
0,
1,
0,
0,
469,
0,
0
],
[
1,
0,
0.1364,
0.0455,
0,
0.... | [
"from django.db import models",
"from django.contrib.contenttypes.models import ContentType",
"from django.utils.encoding import force_unicode",
"class CommentManager(models.Manager):\n\n def in_moderation(self):\n \"\"\"\n QuerySet for all comments currently in the moderation queue.\n ... |
from django.conf.urls.defaults import *
urlpatterns = patterns('django.contrib.comments.views',
url(r'^post/$', 'comments.post_comment', name='comments-post-comment'),
url(r'^posted/$', 'comments.comment_done', name='comments-comment-done'),
url(r'^flag/(\d+)/$', 'modera... | [
[
1,
0,
0.0625,
0.0625,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
14,
0,
0.4688,
0.625,
0,
0.66,
1,
990,
3,
9,
0,
0,
75,
10,
9
]
] | [
"from django.conf.urls.defaults import *",
"urlpatterns = patterns('django.contrib.comments.views',\n url(r'^post/$', 'comments.post_comment', name='comments-post-comment'),\n url(r'^posted/$', 'comments.comment_done', name='comments-comment-done'),\n url(r'^flag/(\\d+)/$', ... |
from django import template
from django.template.loader import render_to_string
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib import comments
from django.utils.encoding import smart_unicode
register = template.Library()
class BaseCommentNode(t... | [
[
1,
0,
0.003,
0.003,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.006,
0.003,
0,
0.66,
0.0385,
970,
0,
1,
0,
0,
970,
0,
0
],
[
1,
0,
0.009,
0.003,
0,
0.66,
... | [
"from django import template",
"from django.template.loader import render_to_string",
"from django.conf import settings",
"from django.contrib.contenttypes.models import ContentType",
"from django.contrib import comments",
"from django.utils.encoding import smart_unicode",
"register = template.Library()... |
from django.contrib import admin
from django.contrib.comments.models import Comment
from django.utils.translation import ugettext_lazy as _, ungettext
from django.contrib.comments import get_model
from django.contrib.comments.views.moderation import perform_flag, perform_approve, perform_delete
class CommentsAdm... | [
[
1,
0,
0.0141,
0.0141,
0,
0.66,
0,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.0282,
0.0141,
0,
0.66,
0.1667,
418,
0,
1,
0,
0,
418,
0,
0
],
[
1,
0,
0.0423,
0.0141,
0,
... | [
"from django.contrib import admin",
"from django.contrib.comments.models import Comment",
"from django.utils.translation import ugettext_lazy as _, ungettext",
"from django.contrib.comments import get_model",
"from django.contrib.comments.views.moderation import perform_flag, perform_approve, perform_delete... |
from django.conf import settings
from django.core import urlresolvers
from django.core.exceptions import ImproperlyConfigured
from django.contrib.comments.models import Comment
from django.contrib.comments.forms import CommentForm
from django.utils.importlib import import_module
DEFAULT_COMMENTS_APP = 'django.c... | [
[
1,
0,
0.011,
0.011,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.022,
0.011,
0,
0.66,
0.0714,
913,
0,
1,
0,
0,
913,
0,
0
],
[
1,
0,
0.033,
0.011,
0,
0.66,
... | [
"from django.conf import settings",
"from django.core import urlresolvers",
"from django.core.exceptions import ImproperlyConfigured",
"from django.contrib.comments.models import Comment",
"from django.contrib.comments.forms import CommentForm",
"from django.utils.importlib import import_module",
"DEFAU... |
"""
Create a superuser from the command line. Deprecated; use manage.py
createsuperuser instead.
"""
if __name__ == "__main__":
from django.core.management import call_command
call_command("createsuperuser")
| [
[
8,
0,
0.3125,
0.5,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
4,
0,
0.875,
0.375,
0,
0.66,
1,
0,
0,
0,
0,
0,
0,
0,
1
],
[
1,
1,
0.875,
0.125,
1,
0.49,
0,
879... | [
"\"\"\"\nCreate a superuser from the command line. Deprecated; use manage.py\ncreatesuperuser instead.\n\"\"\"",
"if __name__ == \"__main__\":\n from django.core.management import call_command\n call_command(\"createsuperuser\")",
" from django.core.management import call_command",
" call_command(... |
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.models import get_current_site
from django.template import Context, loader
from django import forms
from django.utils.translation import... | [
[
1,
0,
0.0047,
0.0047,
0,
0.66,
0,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.0093,
0.0047,
0,
0.66,
0.0667,
895,
0,
1,
0,
0,
895,
0,
0
],
[
1,
0,
0.014,
0.0047,
0,
0... | [
"from django.contrib.auth.models import User",
"from django.contrib.auth import authenticate",
"from django.contrib.auth.tokens import default_token_generator",
"from django.contrib.sites.models import get_current_site",
"from django.template import Context, loader",
"from django import forms",
"from dj... |
from django.core.context_processors import PermWrapper
from django.utils.functional import lazy, memoize, SimpleLazyObject
from django.contrib import messages
def auth(request):
"""
Returns context variables required by apps that use Django's authentication
system.
If there is no 'user' attri... | [
[
1,
0,
0.0303,
0.0303,
0,
0.66,
0,
55,
0,
1,
0,
0,
55,
0,
0
],
[
1,
0,
0.0606,
0.0303,
0,
0.66,
0.3333,
375,
0,
3,
0,
0,
375,
0,
0
],
[
1,
0,
0.0909,
0.0303,
0,
0.... | [
"from django.core.context_processors import PermWrapper",
"from django.utils.functional import lazy, memoize, SimpleLazyObject",
"from django.contrib import messages",
"def auth(request):\n \"\"\"\n Returns context variables required by apps that use Django's authentication\n system.\n\n If there ... |
from django.db import connection
from django.contrib.auth.models import User, Permission
class ModelBackend(object):
"""
Authenticates against django.contrib.auth.models.User.
"""
supports_object_permissions = False
supports_anonymous_user = True
# TODO: Model, login attribute name... | [
[
1,
0,
0.0084,
0.0084,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0168,
0.0084,
0,
0.66,
0.3333,
808,
0,
2,
0,
0,
808,
0,
0
],
[
3,
0,
0.2647,
0.4538,
0,
0.... | [
"from django.db import connection",
"from django.contrib.auth.models import User, Permission",
"class ModelBackend(object):\n \"\"\"\n Authenticates against django.contrib.auth.models.User.\n \"\"\"\n supports_object_permissions = False\n supports_anonymous_user = True\n\n # TODO: Model, login... |
import datetime
import urllib
from django.contrib import auth
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.db.models.manager import EmptyManager
from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import smart_str
from djang... | [
[
1,
0,
0.0021,
0.0021,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0042,
0.0021,
0,
0.66,
0.0435,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.0084,
0.0021,
0,
... | [
"import datetime",
"import urllib",
"from django.contrib import auth",
"from django.core.exceptions import ImproperlyConfigured",
"from django.db import models",
"from django.db.models.manager import EmptyManager",
"from django.contrib.contenttypes.models import ContentType",
"from django.utils.encodi... |
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.updat... | [
[
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 ... |
import warnings
from django.conf import settings
from django.contrib.auth.models import User, Group, Permission, AnonymousUser
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
class BackendTest(TestCase):
backend = 'django.contrib.auth.backends.ModelBackend'
... | [
[
1,
0,
0.004,
0.004,
0,
0.66,
0,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.0119,
0.004,
0,
0.66,
0.0833,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0158,
0.004,
0,
0.66... | [
"import warnings",
"from django.conf import settings",
"from django.contrib.auth.models import User, Group, Permission, AnonymousUser",
"from django.contrib.contenttypes.models import ContentType",
"from django.test import TestCase",
"class BackendTest(TestCase):\n\n backend = 'django.contrib.auth.back... |
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm, PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm
from django.test import TestCase
class UserCreationFormTest(TestCase):
fixtures = ['authtestdata.json']
def... | [
[
1,
0,
0.004,
0.004,
0,
0.66,
0,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.0079,
0.004,
0,
0.66,
0.125,
579,
0,
6,
0,
0,
579,
0,
0
],
[
1,
0,
0.0119,
0.004,
0,
0.66,... | [
"from django.contrib.auth.models import User",
"from django.contrib.auth.forms import UserCreationForm, AuthenticationForm, PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm",
"from django.test import TestCase",
"class UserCreationFormTest(TestCase):\n\n fixtures = ['authtestdata.json... |
from django.conf import settings
from django.test import TestCase
from django.contrib.auth.models import User, SiteProfileNotAvailable
class ProfileTestCase(TestCase):
fixtures = ['authtestdata.json']
def setUp(self):
"""Backs up the AUTH_PROFILE_MODULE"""
self.old_AUTH_PROFILE_MODULE =... | [
[
1,
0,
0.0286,
0.0286,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0571,
0.0286,
0,
0.66,
0.3333,
944,
0,
1,
0,
0,
944,
0,
0
],
[
1,
0,
0.0857,
0.0286,
0,
... | [
"from django.conf import settings",
"from django.test import TestCase",
"from django.contrib.auth.models import User, SiteProfileNotAvailable",
"class ProfileTestCase(TestCase):\n fixtures = ['authtestdata.json']\n def setUp(self):\n \"\"\"Backs up the AUTH_PROFILE_MODULE\"\"\"\n self.old_... |
from django.test import TestCase
from django.contrib.auth.models import User, AnonymousUser
from django.core.management import call_command
from StringIO import StringIO
class BasicTestCase(TestCase):
def test_user(self):
"Check that users can be created and can set their password"
u = User... | [
[
1,
0,
0.0109,
0.0109,
0,
0.66,
0,
944,
0,
1,
0,
0,
944,
0,
0
],
[
1,
0,
0.0217,
0.0109,
0,
0.66,
0.25,
808,
0,
2,
0,
0,
808,
0,
0
],
[
1,
0,
0.0326,
0.0109,
0,
0.... | [
"from django.test import TestCase",
"from django.contrib.auth.models import User, AnonymousUser",
"from django.core.management import call_command",
"from StringIO import StringIO",
"class BasicTestCase(TestCase):\n def test_user(self):\n \"Check that users can be created and can set their passwor... |
from django.conf.urls.defaults import patterns
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.http import HttpResponse
from django.template import Template, RequestContext
def remote_user... | [
[
1,
0,
0.0435,
0.0435,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.087,
0.0435,
0,
0.66,
0.1429,
410,
0,
1,
0,
0,
410,
0,
0
],
[
1,
0,
0.1304,
0.0435,
0,
0... | [
"from django.conf.urls.defaults import patterns",
"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.http import HttpResponse",
"from django.template import Template, RequestC... |
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
class RemoteUserTest(TestCase):
urls = 'django.contrib.auth.tests.urls'
middleware = 'django.contr... | [
[
1,
0,
0.0059,
0.0059,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0176,
0.0059,
0,
0.66,
0.1111,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0235,
0.0059,
0,
... | [
"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",
"class RemoteUserTest(TestCase):\n\n urls = 'django.contrib.auth.tests.urls'\n middlew... |
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... | [
[
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, AnonymousUser
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.test import TestCase
class TokenGeneratorTest(TestCase):
def test_make_token(self):
"... | [
[
1,
0,
0.0135,
0.0135,
0,
0.66,
0,
426,
0,
2,
0,
0,
426,
0,
0
],
[
1,
0,
0.0405,
0.0135,
0,
0.66,
0.2,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0541,
0.0135,
0,
0.6... | [
"from datetime import date, timedelta",
"from django.conf import settings",
"from django.contrib.auth.models import User, AnonymousUser",
"from django.contrib.auth.tokens import PasswordResetTokenGenerator",
"from django.test import TestCase",
"class TokenGeneratorTest(TestCase):\n\n def test_make_toke... |
import os
import re
import urllib
from django.conf import settings
from django.contrib.auth import SESSION_KEY, REDIRECT_FIELD_NAME
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.sites.models import Site, RequestSite
from django.contrib.auth.models import User
from django.test im... | [
[
1,
0,
0.0035,
0.0035,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.007,
0.0035,
0,
0.66,
0.0667,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0105,
0.0035,
0,
0... | [
"import os",
"import re",
"import urllib",
"from django.conf import settings",
"from django.contrib.auth import SESSION_KEY, REDIRECT_FIELD_NAME",
"from django.contrib.auth.forms import AuthenticationForm",
"from django.contrib.sites.models import Site, RequestSite",
"from django.contrib.auth.models i... |
from django.contrib.auth.tests.auth_backends import BackendTest, RowlevelBackendTest, AnonymousUserBackendTest, NoAnonymousUserBackendTest
from django.contrib.auth.tests.basic import BasicTestCase
from django.contrib.auth.tests.decorators import LoginRequiredTestCase
from django.contrib.auth.tests.forms import UserC... | [
[
1,
0,
0.0833,
0.0833,
0,
0.66,
0,
769,
0,
4,
0,
0,
769,
0,
0
],
[
1,
0,
0.1667,
0.0833,
0,
0.66,
0.1429,
879,
0,
1,
0,
0,
879,
0,
0
],
[
1,
0,
0.25,
0.0833,
0,
0.... | [
"from django.contrib.auth.tests.auth_backends import BackendTest, RowlevelBackendTest, AnonymousUserBackendTest, NoAnonymousUserBackendTest",
"from django.contrib.auth.tests.basic import BasicTestCase",
"from django.contrib.auth.tests.decorators import LoginRequiredTestCase",
"from django.contrib.auth.tests.f... |
# These URLs are normally mapped to /admin/urls.py. This URLs file is
# provided as a convenience to those who want to deploy these URLs elsewhere.
# This file is also used to provide a reliable view deployment for test purposes.
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^login... | [
[
1,
0,
0.2941,
0.0588,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
14,
0,
0.6765,
0.5882,
0,
0.66,
1,
990,
3,
9,
0,
0,
75,
10,
1
]
] | [
"from django.conf.urls.defaults import *",
"urlpatterns = patterns('',\n (r'^login/$', 'django.contrib.auth.views.login'),\n (r'^logout/$', 'django.contrib.auth.views.logout'),\n (r'^password_change/$', 'django.contrib.auth.views.password_change'),\n (r'^password_change/done/$', 'django.contrib.auth.v... |
from django.contrib import auth
from django.core.exceptions import ImproperlyConfigured
class LazyUser(object):
def __get__(self, request, obj_type=None):
if not hasattr(request, '_cached_user'):
from django.contrib.auth import get_user
request._cached_user = get_user(reque... | [
[
1,
0,
0.0123,
0.0123,
0,
0.66,
0,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.0247,
0.0123,
0,
0.66,
0.25,
160,
0,
1,
0,
0,
160,
0,
0
],
[
3,
0,
0.0926,
0.0741,
0,
0.... | [
"from django.contrib import auth",
"from django.core.exceptions import ImproperlyConfigured",
"class LazyUser(object):\n def __get__(self, request, obj_type=None):\n if not hasattr(request, '_cached_user'):\n from django.contrib.auth import get_user\n request._cached_user = get_u... |
try:
from functools import update_wrapper, wraps
except ImportError:
from django.utils.functional import update_wrapper, wraps # Python 2.4 fallback.
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.http import HttpResponseRedirect
from django.utils.decorators import available_attrs
fro... | [
[
7,
0,
0.0472,
0.0755,
0,
0.66,
0,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.0377,
0.0189,
1,
0.06,
0,
711,
0,
2,
0,
0,
711,
0,
0
],
[
1,
1,
0.0755,
0.0189,
1,
0.06,
... | [
"try:\n from functools import update_wrapper, wraps\nexcept ImportError:\n from django.utils.functional import update_wrapper, wraps # Python 2.4 fallback.",
" from functools import update_wrapper, wraps",
" from django.utils.functional import update_wrapper, wraps # Python 2.4 fallback.",
"from... |
from django import template
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
fr... | [
[
1,
0,
0.007,
0.007,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.014,
0.007,
0,
0.66,
0.0526,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.021,
0.007,
0,
0.66,
... | [
"from django import template",
"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 djang... |
"""
Management utility to create superusers.
"""
import getpass
import os
import re
import sys
from optparse import make_option
from django.contrib.auth.models import User
from django.core import exceptions
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation impo... | [
[
8,
0,
0.0145,
0.0217,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0362,
0.0072,
0,
0.66,
0.0769,
784,
0,
1,
0,
0,
784,
0,
0
],
[
1,
0,
0.0435,
0.0072,
0,
0.66... | [
"\"\"\"\nManagement utility to create superusers.\n\"\"\"",
"import getpass",
"import os",
"import re",
"import sys",
"from optparse import make_option",
"from django.contrib.auth.models import User",
"from django.core import exceptions",
"from django.core.management.base import BaseCommand, Command... |
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
import getpass
class Command(BaseCommand):
help = "Change a user's password for django.contrib.auth."
requires_model_validation = False
def _get_pass(self, prompt="Password: "):
... | [
[
1,
0,
0.0208,
0.0208,
0,
0.66,
0,
931,
0,
2,
0,
0,
931,
0,
0
],
[
1,
0,
0.0417,
0.0208,
0,
0.66,
0.3333,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.0625,
0.0208,
0,
... | [
"from django.core.management.base import BaseCommand, CommandError",
"from django.contrib.auth.models import User",
"import getpass",
"class Command(BaseCommand):\n help = \"Change a user's password for django.contrib.auth.\"\n\n requires_model_validation = False\n\n def _get_pass(self, prompt=\"Pass... |
"""
Creates permissions for all installed apps that need permissions.
"""
from django.contrib.auth import models as auth_app
from django.db.models import get_models, signals
def _get_permission_codename(action, opts):
return u'%s_%s' % (action, opts.object_name.lower())
def _get_all_permissions(opts)... | [
[
8,
0,
0.026,
0.039,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0649,
0.013,
0,
0.66,
0.125,
895,
0,
1,
0,
0,
895,
0,
0
],
[
1,
0,
0.0779,
0.013,
0,
0.66,
... | [
"\"\"\"\nCreates permissions for all installed apps that need permissions.\n\"\"\"",
"from django.contrib.auth import models as auth_app",
"from django.db.models import get_models, signals",
"def _get_permission_codename(action, opts):\n return u'%s_%s' % (action, opts.object_name.lower())",
" return ... |
from datetime import date
from django.conf import settings
from django.utils.hashcompat import sha_constructor
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 u... | [
[
1,
0,
0.0122,
0.0122,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0366,
0.0122,
0,
0.66,
0.1667,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0488,
0.0122,
0,
... | [
"from datetime import date",
"from django.conf import settings",
"from django.utils.hashcompat import sha_constructor",
"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 \"\"\... |
import re
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
# Avoid shadowing the login() view below.
from django.contrib.auth import login as auth_login
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AuthenticationForm
from djan... | [
[
1,
0,
0.0053,
0.0053,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0106,
0.0053,
0,
0.66,
0.037,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0159,
0.0053,
0,
0... | [
"import re",
"from django.conf import settings",
"from django.contrib.auth import REDIRECT_FIELD_NAME",
"from django.contrib.auth import login as auth_login",
"from django.contrib.auth.decorators import login_required",
"from django.contrib.auth.forms import AuthenticationForm",
"from django.contrib.aut... |
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 b... | [
[
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... | [
[
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(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.7,
... | [
"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,
... | [
[
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.defaults import *
from django.contrib.admindocs import views
urlpatterns = patterns('',
url('^$',
views.doc_index,
name='django-admindocs-docroot'
),
url('^bookmarklets/$',
views.bookmarklets,
name='django-admindocs-bookmarklets'
),
... | [
[
1,
0,
0.0244,
0.0244,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
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.defaults import *",
"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 ... | [
[
8,
0,
0.0095,
0.0095,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0286,
0.0095,
0,
0.66,
0.0714,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0381,
0.0095,
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 f... | [
[
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=s... | [
[
1,
0,
0.0179,
0.0179,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0357,
0.0179,
0,
0.66,
0.2,
890,
0,
3,
0,
0,
890,
0,
0
],
[
1,
0,
0.0536,
0.0179,
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... | [
[
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.contrib.sites.models import Site
from django.contrib.sites import models as site_app
def create_default_site(app, created_models, verbosity, db, **kwargs):
if Site in created_models:
if verbosity >= 2:
... | [
[
8,
0,
0.1176,
0.1765,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2941,
0.0588,
0,
0.66,
0.2,
680,
0,
1,
0,
0,
680,
0,
0
],
[
1,
0,
0.3529,
0.0588,
0,
0.66,
... | [
"\"\"\"\nCreates the default Site object.\n\"\"\"",
"from django.db.models import signals",
"from django.contrib.sites.models import Site",
"from django.contrib.sites import models as site_app",
"def create_default_site(app, created_models, verbosity, db, **kwargs):\n if Site in created_models:\n ... |
from django.contrib.admin.filterspecs import FilterSpec
from django.contrib.admin.options import IncorrectLookupParameters
from django.contrib.admin.util import quote
from django.core.paginator import Paginator, InvalidPage
from django.db import models
from django.utils.encoding import force_unicode, smart_str
fr... | [
[
1,
0,
0.0041,
0.0041,
0,
0.66,
0,
229,
0,
1,
0,
0,
229,
0,
0
],
[
1,
0,
0.0082,
0.0041,
0,
0.66,
0.0526,
84,
0,
1,
0,
0,
84,
0,
0
],
[
1,
0,
0.0123,
0.0041,
0,
0.... | [
"from django.contrib.admin.filterspecs import FilterSpec",
"from django.contrib.admin.options import IncorrectLookupParameters",
"from django.contrib.admin.util import quote",
"from django.core.paginator import Paginator, InvalidPage",
"from django.db import models",
"from django.utils.encoding import for... |
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
from django import http, template
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import render_to_response
from ... | [
[
7,
0,
0.0333,
0.0533,
0,
0.66,
0,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.0267,
0.0133,
1,
0.37,
0,
711,
0,
1,
0,
0,
711,
0,
0
],
[
1,
1,
0.0533,
0.0133,
1,
0.37,
... | [
"try:\n from functools import wraps\nexcept ImportError:\n from django.utils.functional import wraps # Python 2.4 fallback.",
" from functools import wraps",
" from django.utils.functional import wraps # Python 2.4 fallback.",
"from django import http, template",
"from django.contrib.auth.mode... |
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 impor... | [
[
1,
0,
0.0185,
0.0185,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.037,
0.0185,
0,
0.66,
0.0909,
469,
0,
1,
0,
0,
469,
0,
0
],
[
1,
0,
0.0556,
0.0185,
0,
0.6... | [
"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 ... |
#!/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 Goo... | [
[
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 ... |
#!/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 Goo... | [
[
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 ... |
"""
FilterSpec encapsulates the logic for displaying filters in the Django admin.
Filters are specified in models with the "list_filter" option.
Each filter subclass knows how to display a filter for a field that passes a
certain test -- e.g. being a DateField or ForeignKey.
"""
from django.db import models
... | [
[
8,
0,
0.0223,
0.0391,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0503,
0.0056,
0,
0.66,
0.0588,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0559,
0.0056,
0,
0.66,
... | [
"\"\"\"\nFilterSpec encapsulates the logic for displaying filters in the Django admin.\nFilters are specified in models with the \"list_filter\" option.\n\nEach filter subclass knows how to display a filter for a field that passes a\ncertain test -- e.g. being a DateField or ForeignKey.\n\"\"\"",
"from django.db ... |
from django import template
register = template.Library()
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 inlines.
"""
prepopulated_fields = []
if context['add'] and '... | [
[
1,
0,
0.0238,
0.0238,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
14,
0,
0.0714,
0.0238,
0,
0.66,
0.2,
276,
3,
0,
0,
0,
77,
10,
1
],
[
2,
0,
0.2857,
0.3571,
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... |
from django.template import Library
from django.utils.encoding import iri_to_uri
register = Library()
def admin_media_prefix():
"""
Returns the string contained in the setting ADMIN_MEDIA_PREFIX.
"""
try:
from django.conf import settings
except ImportError:
return ''
... | [
[
1,
0,
0.0667,
0.0667,
0,
0.66,
0,
213,
0,
1,
0,
0,
213,
0,
0
],
[
1,
0,
0.1333,
0.0667,
0,
0.66,
0.25,
96,
0,
1,
0,
0,
96,
0,
0
],
[
14,
0,
0.2667,
0.0667,
0,
0.6... | [
"from django.template import Library",
"from django.utils.encoding import iri_to_uri",
"register = Library()",
"def admin_media_prefix():\n \"\"\"\n Returns the string contained in the setting ADMIN_MEDIA_PREFIX.\n \"\"\"\n try:\n from django.conf import settings\n except ImportError:\n ... |
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... | [
[
1,
0,
0.0175,
0.0175,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0351,
0.0175,
0,
0.66,
0.2,
408,
0,
1,
0,
0,
408,
0,
0
],
[
14,
0,
0.0702,
0.0175,
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 ... |
import datetime
from django.conf import settings
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
from django.contrib.admin.views.main import ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SEARCH_VAR
from djan... | [
[
1,
0,
0.0033,
0.0033,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0099,
0.0033,
0,
0.66,
0.0294,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0132,
0.0033,
0,
... | [
"import datetime",
"from django.conf import settings",
"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",
"from django.contrib.admin.views.main import ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SE... |
from django.db import models
from django.db.models.deletion import Collector
from django.db.models.related import RelatedObject
from django.forms.forms import pretty_name
from django.utils import formats
from django.utils.html import escape
from django.utils.safestring import mark_safe
from django.utils.text imp... | [
[
1,
0,
0.0035,
0.0035,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0071,
0.0035,
0,
0.66,
0.0476,
229,
0,
1,
0,
0,
229,
0,
0
],
[
1,
0,
0.0106,
0.0035,
0,
0.... | [
"from django.db import models",
"from django.db.models.deletion import Collector",
"from django.db.models.related import RelatedObject",
"from django.forms.forms import pretty_name",
"from django.utils import formats",
"from django.utils.html import escape",
"from django.utils.safestring import mark_saf... |
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.forms.models import (BaseModelForm, BaseModelFormSet, fields_for_model,
_get_foreign_key)
from django.contrib.admin.options import flatten_fieldsets, BaseModelAdmin
from django.contrib.admin.options import HORIZONT... | [
[
1,
0,
0.0026,
0.0026,
0,
0.66,
0,
160,
0,
1,
0,
0,
160,
0,
0
],
[
1,
0,
0.0053,
0.0026,
0,
0.66,
0.0769,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0093,
0.0053,
0,
0.... | [
"from django.core.exceptions import ImproperlyConfigured",
"from django.db import models",
"from django.forms.models import (BaseModelForm, BaseModelFormSet, fields_for_model,\n _get_foreign_key)",
"from django.contrib.admin.options import flatten_fieldsets, BaseModelAdmin",
"from django.contrib.admin.op... |
from django import forms
from django.conf import settings
from django.contrib.admin.util import flatten_fieldsets, lookup_field
from django.contrib.admin.util import display_for_field, label_for_field
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
... | [
[
1,
0,
0.0029,
0.0029,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0059,
0.0029,
0,
0.66,
0.0385,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0088,
0.0029,
0,
... | [
"from django import forms",
"from django.conf import settings",
"from django.contrib.admin.util import flatten_fieldsets, lookup_field",
"from django.contrib.admin.util import display_for_field, label_for_field",
"from django.contrib.contenttypes.models import ContentType",
"from django.core.exceptions im... |
from django import forms, template
from django.forms.formsets import all_valid
from django.forms.models import modelform_factory, modelformset_factory, inlineformset_factory
from django.forms.models import BaseInlineFormSet
from django.contrib.contenttypes.models import ContentType
from django.contrib.admin import... | [
[
1,
0,
0.0008,
0.0008,
0,
0.66,
0,
294,
0,
2,
0,
0,
294,
0,
0
],
[
1,
0,
0.0016,
0.0008,
0,
0.66,
0.0294,
42,
0,
1,
0,
0,
42,
0,
0
],
[
1,
0,
0.0023,
0.0008,
0,
0.... | [
"from django import forms, template",
"from django.forms.formsets import all_valid",
"from django.forms.models import modelform_factory, modelformset_factory, inlineformset_factory",
"from django.forms.models import BaseInlineFormSet",
"from django.contrib.contenttypes.models import ContentType",
"from dj... |
import re
from django import http, template
from django.contrib.admin import ModelAdmin
from django.contrib.admin import actions
from django.contrib.auth import authenticate, login
from django.views.decorators.csrf import csrf_protect
from django.db.models.base import ModelBase
from django.core.exceptions import... | [
[
1,
0,
0.0022,
0.0022,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0043,
0.0022,
0,
0.66,
0.0476,
294,
0,
2,
0,
0,
294,
0,
0
],
[
1,
0,
0.0065,
0.0022,
0,
... | [
"import re",
"from django import http, template",
"from django.contrib.admin import ModelAdmin",
"from django.contrib.admin import actions",
"from django.contrib.auth import authenticate, login",
"from django.views.decorators.csrf import csrf_protect",
"from django.db.models.base import ModelBase",
"f... |
"""
Form Widget classes specific to the Django admin site.
"""
import django.utils.copycompat as copy
from django import forms
from django.forms.widgets import RadioFieldRenderer
from django.forms.util import flatatt
from django.utils.html import escape
from django.utils.text import truncate_words
from dja... | [
[
8,
0,
0.007,
0.0105,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0174,
0.0035,
0,
0.66,
0.0385,
125,
0,
1,
0,
0,
125,
0,
0
],
[
1,
0,
0.0244,
0.0035,
0,
0.66,... | [
"\"\"\"\nForm Widget classes specific to the Django admin site.\n\"\"\"",
"import django.utils.copycompat as copy",
"from django import forms",
"from django.forms.widgets import RadioFieldRenderer",
"from django.forms.util import flatatt",
"from django.utils.html import escape",
"from django.utils.text ... |
# 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, Tabular... | [
[
1,
0,
0.0789,
0.0263,
0,
0.66,
0,
140,
0,
1,
0,
0,
140,
0,
0
],
[
1,
0,
0.1053,
0.0263,
0,
0.66,
0.25,
84,
0,
3,
0,
0,
84,
0,
0
],
[
1,
0,
0.1316,
0.0263,
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",
"def autodiscover():\n \"\"\"\n ... |
"""
Built-in, globally-available admin actions.
"""
from django import template
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.shortcuts import rende... | [
[
8,
0,
0.027,
0.0405,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0676,
0.0135,
0,
0.66,
0.1,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0811,
0.0135,
0,
0.66,
... | [
"\"\"\"\nBuilt-in, globally-available admin actions.\n\"\"\"",
"from django import template",
"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",
"f... |
import cStringIO, 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 = cStringIO.StringIO()
zf = zipfile.ZipFile(kmz, 'a', zipfile.ZIP_DEFLATED)
zf.write... | [
[
1,
0,
0.0312,
0.0312,
0,
0.66,
0,
764,
0,
2,
0,
0,
764,
0,
0
],
[
1,
0,
0.0625,
0.0312,
0,
0.66,
0.1429,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0938,
0.0312,
0,
... | [
"import cStringIO, zipfile",
"from django.conf import settings",
"from django.http import HttpResponse",
"from django.template import loader",
"def compress_kml(kml):\n \"Returns compressed KMZ from the given KML string.\"\n kmz = cStringIO.StringIO()\n zf = zipfile.ZipFile(kmz, 'a', zipfile.ZIP_DE... |
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.o... | [
[
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.92,
... | [
"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 (a... | [
[
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, lo... | [
[
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 ... | [
[
1,
0,
0.009,
0.009,
0,
0.66,
0,
779,
0,
2,
0,
0,
779,
0,
0
],
[
1,
0,
0.018,
0.009,
0,
0.66,
0.0769,
213,
0,
1,
0,
0,
213,
0,
0
],
[
1,
0,
0.027,
0.009,
0,
0.66,
... | [
"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.6667,
1,
0,
0.66,
0,
886,
0,
2,
0,
0,
886,
0,
0
]
] | [
"from django.contrib.gis.geos import \\\n GEOSGeometry as Geometry, \\\n 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... | [
[
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=(?... | [
[
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'[ACEG... |
from django.contrib.gis.geos import GEOSGeometry, LinearRing, Polygon, Point
from django.contrib.gis.maps.google.gmap import GoogleMapException
from math import pi, sin, cos, log, exp, atan
# Constants used for degree to radian conversion, and vice-versa.
DTOR = pi / 180.
RTOD = 180. / pi
class GoogleZoom(obj... | [
[
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, cos, log, exp, atan",
"DTOR = pi / 180.",
"RTOD = 180. / pi",
"class GoogleZoom(object):\n \"\"\"\n GoogleZoom is a utility... |
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.
... | [
[
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' : Google... | [
[
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.contrib.gis import geos
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
class GoogleMapException(Exception): pass
from django.contrib.gis.maps.google.overlays import GPolygon, GPolyline, GMarker, GIcon
# The default... | [
[
1,
0,
0.0044,
0.0044,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0088,
0.0044,
0,
0.66,
0.125,
735,
0,
1,
0,
0,
735,
0,
0
],
[
1,
0,
0.0133,
0.0044,
0,
0... | [
"from django.conf import settings",
"from django.contrib.gis import geos",
"from django.template.loader import render_to_string",
"from django.utils.safestring import mark_safe",
"class GoogleMapException(Exception): pass",
"from django.contrib.gis.maps.google.overlays import GPolygon, GPolyline, GMarker,... |
from django.contrib.syndication.feeds import Feed as BaseFeed, FeedDoesNotExist
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.
... | [
[
1,
0,
0.0074,
0.0074,
0,
0.66,
0,
211,
0,
2,
0,
0,
211,
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.feeds import Feed as BaseFeed, FeedDoesNotExist",
"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 ... |
"""
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:
... | [
[
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.51,
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... |
"""
This module houses the GeoIP object, a ctypes wrapper for the MaxMind GeoIP(R)
C API (http://www.maxmind.com/app/c). This is an alternative to the GPL
licensed Python GeoIP interface provided by MaxMind.
GeoIP(R) is a registered trademark of MaxMind, LLC of Boston, Massachusetts.
For IP-based geoloca... | [
[
8,
0,
0.0568,
0.1108,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1136,
0.0028,
0,
0.66,
0.0294,
688,
0,
2,
0,
0,
688,
0,
0
],
[
1,
0,
0.1163,
0.0028,
0,
0.66... | [
"\"\"\"\n This module houses the GeoIP object, a ctypes wrapper for the MaxMind GeoIP(R)\n C API (http://www.maxmind.com/app/c). This is an alternative to the GPL\n licensed Python GeoIP interface provided by MaxMind.\n\n GeoIP(R) is a registered trademark of MaxMind, LLC of Boston, Massachusetts.\n\n For IP-based... |
"""
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 ... | [
[
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_sou... | [
[
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, ogrins... | [
[
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.25,
793,
0,
1,
0,
0,
793,
0,
0
],
[
4,
0,
0.42,
0.4,
0,
0.66,
0.5,
0... | [
"\"\"\"\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
from django.db import connections, DEFAULT_DB_ALIAS
def add_srs_entry(srs, auth_name='EPSG', auth_srid=None, ref_sys_name=None,
database=DEFAULT_DB_ALIAS):
"""
This function takes a GDAL SpatialReference system and adds its informatio... | [
[
1,
0,
0.013,
0.013,
0,
0.66,
0,
793,
0,
1,
0,
0,
793,
0,
0
],
[
1,
0,
0.026,
0.013,
0,
0.66,
0.3333,
40,
0,
2,
0,
0,
40,
0,
0
],
[
2,
0,
0.5065,
0.9221,
0,
0.66,
... | [
"from django.contrib.gis.gdal import SpatialReference",
"from django.db import connections, DEFAULT_DB_ALIAS",
"def add_srs_entry(srs, auth_name='EPSG', auth_srid=None, ref_sys_name=None,\n database=DEFAULT_DB_ALIAS):\n \"\"\"\n This function takes a GDAL SpatialReference system and adds ... |
from django.contrib.gis.sitemaps import GeoRSSSitemap, KMLSitemap, KMZSitemap
from models import City, Country
from feeds import feed_dict
sitemaps = {'kml' : KMLSitemap([City, Country]),
'kmz' : KMZSitemap([City, Country]),
'georss' : GeoRSSSitemap(feed_dict),
}
| [
[
1,
0,
0.125,
0.125,
0,
0.66,
0,
123,
0,
3,
0,
0,
123,
0,
0
],
[
1,
0,
0.25,
0.125,
0,
0.66,
0.3333,
495,
0,
2,
0,
0,
495,
0,
0
],
[
1,
0,
0.375,
0.125,
0,
0.66,
... | [
"from django.contrib.gis.sitemaps import GeoRSSSitemap, KMLSitemap, KMZSitemap",
"from models import City, Country",
"from feeds import feed_dict",
"sitemaps = {'kml' : KMLSitemap([City, Country]),\n 'kmz' : KMZSitemap([City, Country]),\n 'georss' : GeoRSSSitemap(feed_dict),\n ... |
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, i... | [
[
1,
0,
0.0222,
0.0222,
0,
0.66,
0,
964,
0,
1,
0,
0,
964,
0,
0
],
[
1,
0,
0.0444,
0.0222,
0,
0.66,
0.125,
185,
0,
2,
0,
0,
185,
0,
0
],
[
14,
0,
0.1111,
0.0222,
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()\... |
import re, os, unittest
from django.db import connection
from django.contrib.gis import gdal
from django.contrib.gis.geos import *
from django.contrib.gis.measure import Distance
from django.contrib.gis.tests.utils import \
no_mysql, no_oracle, no_postgis, no_spatialite, \
mysql, oracle, postgis, spatial... | [
[
1,
0,
0.0013,
0.0013,
0,
0.66,
0,
540,
0,
3,
0,
0,
540,
0,
0
],
[
1,
0,
0.0027,
0.0013,
0,
0.66,
0.0769,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.004,
0.0013,
0,
0.6... | [
"import re, os, unittest",
"from django.db import connection",
"from django.contrib.gis import gdal",
"from django.contrib.gis.geos import *",
"from django.contrib.gis.measure import Distance",
"from django.contrib.gis.tests.utils import \\\n no_mysql, no_oracle, no_postgis, no_spatialite, \\\n mysq... |
from django.contrib.gis import feeds
from django.contrib.gis.tests.utils import mysql
from models import City, Country
class TestGeoRSS1(feeds.Feed):
link = '/city/'
title = 'Test GeoDjango Cities'
def items(self):
return City.objects.all()
def item_link(self, item):
retur... | [
[
1,
0,
0.0159,
0.0159,
0,
0.66,
0,
735,
0,
1,
0,
0,
735,
0,
0
],
[
1,
0,
0.0317,
0.0159,
0,
0.66,
0.1,
185,
0,
1,
0,
0,
185,
0,
0
],
[
1,
0,
0.0476,
0.0159,
0,
0.6... | [
"from django.contrib.gis import feeds",
"from django.contrib.gis.tests.utils import mysql",
"from models import City, Country",
"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):... |
from django.conf.urls.defaults import *
from feeds import feed_dict
urlpatterns = patterns('',
(r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feed_dict}),
)
from sitemaps import sitemaps
urlpatterns += patterns('django.contrib.gis.sitemaps.views',
(r'^sitemap.xml$', ... | [
[
1,
0,
0.0714,
0.0714,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.1429,
0.0714,
0,
0.66,
0.3333,
11,
0,
1,
0,
0,
11,
0,
0
],
[
14,
0,
0.3571,
0.2143,
0,
0... | [
"from django.conf.urls.defaults import *",
"from feeds import feed_dict",
"urlpatterns = patterns('',\n (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feed_dict}),\n)",
"from sitemaps import sitemaps"
] |
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_lengt... | [
[
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.1,... | [
"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... |
import os, re, unittest
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, Interstate2D, Interstate3D, \
InterstateProj2D, InterstateProj3D, \
... | [
[
1,
0,
0.0043,
0.0043,
0,
0.66,
0,
688,
0,
3,
0,
0,
688,
0,
0
],
[
1,
0,
0.0085,
0.0043,
0,
0.66,
0.0667,
472,
0,
2,
0,
0,
472,
0,
0
],
[
1,
0,
0.0128,
0.0043,
0,
... | [
"import os, re, unittest",
"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, Interstate2D, Interstate3D, \\\n InterstateProj2D, Int... |
# Create your views here.
| [] | [] |
au_cities = (('Wollongong', 150.902, -34.4245),
('Shellharbour', 150.87, -34.5789),
('Thirroul', 150.924, -34.3147),
('Mittagong', 150.449, -34.4509),
('Batemans Bay', 150.175, -35.7082),
('Canberra', 144.963, -37.8143),
('Melbourne', 1... | [
[
14,
0,
0.1806,
0.3333,
0,
0.66,
0,
425,
0,
0,
0,
0,
0,
8,
0
],
[
14,
0,
0.5139,
0.2778,
0,
0.66,
0.25,
989,
0,
0,
0,
0,
0,
8,
0
],
[
14,
0,
0.7778,
0.1389,
0,
0.6... | [
"au_cities = (('Wollongong', 150.902, -34.4245),\n ('Shellharbour', 150.87, -34.5789),\n ('Thirroul', 150.924, -34.3147),\n ('Mittagong', 150.449, -34.4509),\n ('Batemans Bay', 150.175, -35.7082),\n ('Canberra', 144.963, -37.8143),\n ('Melbourn... |
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
clas... | [
[
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.24,
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... |
import os, unittest
from decimal import Decimal
from django.db import connection
from django.db.models import Q
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.geos import GEOSGeometry, Point, LineString
from django.contrib.gis.measure import D # alias for Distance
from django.contrib.gi... | [
[
1,
0,
0.0026,
0.0026,
0,
0.66,
0,
688,
0,
2,
0,
0,
688,
0,
0
],
[
1,
0,
0.0051,
0.0026,
0,
0.66,
0.0909,
349,
0,
1,
0,
0,
349,
0,
0
],
[
1,
0,
0.0103,
0.0026,
0,
... | [
"import os, unittest",
"from decimal import Decimal",
"from django.db import connection",
"from django.db.models import Q",
"from django.contrib.gis.gdal import DataSource",
"from django.contrib.gis.geos import GEOSGeometry, Point, LineString",
"from django.contrib.gis.measure import D # alias for Dista... |
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)
... | [
[
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.84,
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+
"""
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(self):
"Ensure geography f... | [
[
8,
0,
0.023,
0.0345,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.046,
0.0115,
0,
0.66,
0.1667,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0575,
0.0115,
0,
0.66,
... | [
"\"\"\"\nTests for geography support in PostGIS 1.5+\n\"\"\"",
"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):\n\n def test01_fixture_load(se... |
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) # Multip... | [
[
1,
0,
0.0152,
0.0152,
0,
0.66,
0,
964,
0,
1,
0,
0,
964,
0,
0
],
[
3,
0,
0.0606,
0.0455,
0,
0.66,
0.0833,
110,
0,
0,
0,
0,
996,
0,
2
],
[
14,
1,
0.0606,
0.0152,
1,
... | [
"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)... |
import os
from decimal import Decimal
from django.utils import unittest
from django.utils.copycompat import copy
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.tests.utils import mysql
from django.contrib.gis.utils.layermapping import LayerMapping, LayerMapError, InvalidDecimal, Missin... | [
[
1,
0,
0.0037,
0.0037,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0074,
0.0037,
0,
0.66,
0.0625,
349,
0,
1,
0,
0,
349,
0,
0
],
[
1,
0,
0.0147,
0.0037,
0,
... | [
"import os",
"from decimal import Decimal",
"from django.utils import unittest",
"from django.utils.copycompat import copy",
"from django.contrib.gis.gdal import DataSource",
"from django.contrib.gis.tests.utils import mysql",
"from django.contrib.gis.utils.layermapping import LayerMapping, LayerMapErro... |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^geoapp/', include('django.contrib.gis.tests.geoapp.urls')),
)
| [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
14,
0,
0.6667,
0.5,
0,
0.66,
1,
990,
3,
2,
0,
0,
75,
10,
2
]
] | [
"from django.conf.urls.defaults import *",
"urlpatterns = patterns('',\n (r'^geoapp/', include('django.contrib.gis.tests.geoapp.urls')),\n )"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.