Sorted imports with isort; refs #23860.

This commit is contained in:
Tim Graham 2015-01-28 07:35:27 -05:00
parent 388d986b8a
commit 0ed7d15563
793 changed files with 2551 additions and 2333 deletions

View File

@ -1,10 +1,9 @@
from importlib import import_module
import os import os
from importlib import import_module
from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured
from django.utils.module_loading import module_has_submodule
from django.utils._os import upath from django.utils._os import upath
from django.utils.module_loading import module_has_submodule
MODELS_MODULE_NAME = 'models' MODELS_MODULE_NAME = 'models'

View File

@ -1,7 +1,7 @@
from collections import Counter, defaultdict, OrderedDict
import sys import sys
import threading import threading
import warnings import warnings
from collections import Counter, OrderedDict, defaultdict
from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured
from django.utils import lru_cache from django.utils import lru_cache

View File

@ -10,8 +10,9 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/ https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/
""" """
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

View File

@ -8,7 +8,9 @@ https://docs.djangoproject.com/en/{{ docs_version }}/howto/deployment/wsgi/
""" """
import os import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
from django.core.wsgi import get_wsgi_application from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
application = get_wsgi_application() application = get_wsgi_application()

View File

@ -2,14 +2,14 @@
Built-in, globally-available admin actions. Built-in, globally-available admin actions.
""" """
from django.core.exceptions import PermissionDenied
from django.contrib import messages from django.contrib import messages
from django.contrib.admin import helpers from django.contrib.admin import helpers
from django.contrib.admin.utils import get_deleted_objects, model_ngettext from django.contrib.admin.utils import get_deleted_objects, model_ngettext
from django.core.exceptions import PermissionDenied
from django.db import router from django.db import router
from django.template.response import TemplateResponse from django.template.response import TemplateResponse
from django.utils.encoding import force_text from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy, ugettext as _ from django.utils.translation import ugettext as _, ugettext_lazy
def delete_selected(modeladmin, request, queryset): def delete_selected(modeladmin, request, queryset):

View File

@ -1,6 +1,6 @@
from django.apps import AppConfig from django.apps import AppConfig
from django.core import checks
from django.contrib.admin.checks import check_admin_app from django.contrib.admin.checks import check_admin_app
from django.core import checks
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _

View File

@ -3,11 +3,15 @@ from __future__ import unicode_literals
from itertools import chain from itertools import chain
from django.contrib.admin.utils import get_fields_from_path, NotRelationField, flatten from django.contrib.admin.utils import (
NotRelationField, flatten, get_fields_from_path,
)
from django.core import checks from django.core import checks
from django.core.exceptions import FieldDoesNotExist from django.core.exceptions import FieldDoesNotExist
from django.db import models from django.db import models
from django.forms.models import BaseModelForm, _get_foreign_key, BaseModelFormSet from django.forms.models import (
BaseModelForm, BaseModelFormSet, _get_foreign_key,
)
def check_admin_app(**kwargs): def check_admin_app(**kwargs):

View File

@ -7,15 +7,17 @@ certain test -- e.g. being a DateField or ForeignKey.
""" """
import datetime import datetime
from django.contrib.admin.options import IncorrectLookupParameters
from django.contrib.admin.utils import (
get_limit_choices_to_from_path, get_model_from_relation,
prepare_lookup_value, reverse_field_path,
)
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.db import models from django.db import models
from django.db.models.fields.related import ForeignObjectRel, ManyToManyField from django.db.models.fields.related import ForeignObjectRel, ManyToManyField
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.utils.encoding import smart_text, force_text
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone from django.utils import timezone
from django.contrib.admin.utils import (get_model_from_relation, from django.utils.encoding import force_text, smart_text
reverse_field_path, get_limit_choices_to_from_path, prepare_lookup_value) from django.utils.translation import ugettext_lazy as _
from django.contrib.admin.options import IncorrectLookupParameters
class ListFilter(object): class ListFilter(object):

View File

@ -1,7 +1,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django import forms from django import forms
from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _

View File

@ -3,22 +3,23 @@ from __future__ import unicode_literals
import warnings import warnings
from django import forms from django import forms
from django.contrib.admin.utils import (flatten_fieldsets, lookup_field, from django.conf import settings
display_for_field, label_for_field, help_text_for_field)
from django.contrib.admin.templatetags.admin_static import static from django.contrib.admin.templatetags.admin_static import static
from django.contrib.admin.utils import (
display_for_field, flatten_fieldsets, help_text_for_field, label_for_field,
lookup_field,
)
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.db.models.fields.related import ManyToManyRel from django.db.models.fields.related import ManyToManyRel
from django.forms.utils import flatatt from django.forms.utils import flatatt
from django.template.defaultfilters import capfirst, linebreaksbr from django.template.defaultfilters import capfirst, linebreaksbr
from django.utils import six
from django.utils.deprecation import RemovedInDjango20Warning from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.encoding import force_text, smart_text from django.utils.encoding import force_text, smart_text
from django.utils.functional import cached_property from django.utils.functional import cached_property
from django.utils.html import conditional_escape, format_html from django.utils.html import conditional_escape, format_html
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils import six
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.conf import settings
ACTION_CHECKBOX_NAME = '_selected_action' ACTION_CHECKBOX_NAME = '_selected_action'

View File

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import django.contrib.admin.models import django.contrib.admin.models
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,13 +1,12 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models
from django.conf import settings from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.admin.utils import quote from django.contrib.admin.utils import quote
from django.core.urlresolvers import reverse, NoReverseMatch from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import NoReverseMatch, reverse
from django.db import models
from django.utils.encoding import python_2_unicode_compatible, smart_text
from django.utils.translation import ugettext, ugettext_lazy as _ from django.utils.translation import ugettext, ugettext_lazy as _
from django.utils.encoding import smart_text
from django.utils.encoding import python_2_unicode_compatible
ADDITION = 1 ADDITION = 1
CHANGE = 2 CHANGE = 2

View File

@ -1,34 +1,39 @@
from collections import OrderedDict
import copy import copy
import operator import operator
from collections import OrderedDict
from functools import partial, reduce, update_wrapper from functools import partial, reduce, update_wrapper
from django import forms from django import forms
from django.conf import settings from django.conf import settings
from django.contrib import messages from django.contrib import messages
from django.contrib.admin import widgets, helpers from django.contrib.admin import helpers, widgets
from django.contrib.admin.checks import (BaseModelAdminChecks, ModelAdminChecks, from django.contrib.admin.checks import (
InlineModelAdminChecks) BaseModelAdminChecks, InlineModelAdminChecks, ModelAdminChecks,
)
from django.contrib.admin.exceptions import DisallowedModelAdminToField from django.contrib.admin.exceptions import DisallowedModelAdminToField
from django.contrib.admin.utils import (quote, unquote, flatten_fieldsets,
get_deleted_objects, model_format_dict, NestedObjects,
lookup_needs_distinct)
from django.contrib.admin.templatetags.admin_static import static from django.contrib.admin.templatetags.admin_static import static
from django.contrib.admin.templatetags.admin_urls import add_preserved_filters from django.contrib.admin.templatetags.admin_urls import add_preserved_filters
from django.contrib.admin.utils import (
NestedObjects, flatten_fieldsets, get_deleted_objects,
lookup_needs_distinct, model_format_dict, quote, unquote,
)
from django.contrib.auth import get_permission_codename from django.contrib.auth import get_permission_codename
from django.core.exceptions import (PermissionDenied, ValidationError, from django.core.exceptions import (
FieldDoesNotExist, FieldError) FieldDoesNotExist, FieldError, PermissionDenied, ValidationError,
)
from django.core.paginator import Paginator from django.core.paginator import Paginator
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.db import models, transaction, router from django.db import models, router, transaction
from django.db.models.constants import LOOKUP_SEP from django.db.models.constants import LOOKUP_SEP
from django.db.models.fields import BLANK_CHOICE_DASH from django.db.models.fields import BLANK_CHOICE_DASH
from django.db.models.fields.related import ForeignObjectRel from django.db.models.fields.related import ForeignObjectRel
from django.db.models.sql.constants import QUERY_TERMS from django.db.models.sql.constants import QUERY_TERMS
from django.forms.formsets import all_valid, DELETION_FIELD_NAME from django.forms.formsets import DELETION_FIELD_NAME, all_valid
from django.forms.models import (modelform_factory, modelformset_factory, from django.forms.models import (
inlineformset_factory, BaseInlineFormSet, modelform_defines_fields) BaseInlineFormSet, inlineformset_factory, modelform_defines_fields,
from django.forms.widgets import SelectMultiple, CheckboxSelectMultiple modelform_factory, modelformset_factory,
)
from django.forms.widgets import CheckboxSelectMultiple, SelectMultiple
from django.http import Http404, HttpResponseRedirect from django.http import Http404, HttpResponseRedirect
from django.http.response import HttpResponseBase from django.http.response import HttpResponseBase
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
@ -38,14 +43,11 @@ from django.utils.decorators import method_decorator
from django.utils.encoding import force_text, python_2_unicode_compatible from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.html import escape, escapejs from django.utils.html import escape, escapejs
from django.utils.http import urlencode from django.utils.http import urlencode
from django.utils.text import capfirst, get_text_list
from django.utils.translation import string_concat
from django.utils.translation import ugettext as _
from django.utils.translation import ungettext
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils.text import capfirst, get_text_list
from django.utils.translation import string_concat, ugettext as _, ungettext
from django.views.decorators.csrf import csrf_protect from django.views.decorators.csrf import csrf_protect
IS_POPUP_VAR = '_popup' IS_POPUP_VAR = '_popup'
TO_FIELD_VAR = '_to_field' TO_FIELD_VAR = '_to_field'

View File

@ -1,19 +1,20 @@
from functools import update_wrapper from functools import update_wrapper
from django.http import Http404, HttpResponseRedirect
from django.apps import apps
from django.conf import settings
from django.contrib.admin import ModelAdmin, actions from django.contrib.admin import ModelAdmin, actions
from django.contrib.auth import REDIRECT_FIELD_NAME from django.contrib.auth import REDIRECT_FIELD_NAME
from django.views.decorators.csrf import csrf_protect
from django.db.models.base import ModelBase
from django.apps import apps
from django.core.exceptions import ImproperlyConfigured, PermissionDenied from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.core.urlresolvers import reverse, NoReverseMatch from django.core.urlresolvers import NoReverseMatch, reverse
from django.db.models.base import ModelBase
from django.http import Http404, HttpResponseRedirect
from django.template.engine import Engine from django.template.engine import Engine
from django.template.response import TemplateResponse from django.template.response import TemplateResponse
from django.utils import six from django.utils import six
from django.utils.text import capfirst from django.utils.text import capfirst
from django.utils.translation import ugettext_lazy, ugettext as _ from django.utils.translation import ugettext as _, ugettext_lazy
from django.views.decorators.cache import never_cache from django.views.decorators.cache import never_cache
from django.conf import settings from django.views.decorators.csrf import csrf_protect
system_check_errors = [] system_check_errors = []

View File

@ -2,24 +2,25 @@ from __future__ import unicode_literals
import datetime import datetime
from django.contrib.admin.templatetags.admin_urls import add_preserved_filters
from django.contrib.admin.utils import (lookup_field, display_for_field,
display_for_value, 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.contrib.admin.templatetags.admin_static import static
from django.contrib.admin.templatetags.admin_urls import add_preserved_filters
from django.contrib.admin.utils import (
display_for_field, display_for_value, label_for_field, lookup_field,
)
from django.contrib.admin.views.main import (
ALL_VAR, EMPTY_CHANGELIST_VALUE, ORDER_VAR, PAGE_VAR, SEARCH_VAR,
)
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import NoReverseMatch from django.core.urlresolvers import NoReverseMatch
from django.db import models from django.db import models
from django.template import Library
from django.template.loader import get_template
from django.utils import formats from django.utils import formats
from django.utils.encoding import force_text
from django.utils.html import escapejs, format_html from django.utils.html import escapejs, format_html
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils.text import capfirst from django.utils.text import capfirst
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.utils.encoding import force_text
from django.template import Library
from django.template.loader import get_template
register = Library() register = Library()

View File

@ -6,7 +6,7 @@ from collections import defaultdict
from django.contrib.auth import get_permission_codename from django.contrib.auth import get_permission_codename
from django.core.exceptions import FieldDoesNotExist from django.core.exceptions import FieldDoesNotExist
from django.core.urlresolvers import reverse, NoReverseMatch from django.core.urlresolvers import NoReverseMatch, reverse
from django.db import models from django.db import models
from django.db.models.constants import LOOKUP_SEP from django.db.models.constants import LOOKUP_SEP
from django.db.models.deletion import Collector from django.db.models.deletion import Collector

View File

@ -1,22 +1,26 @@
from collections import OrderedDict
import sys import sys
from collections import OrderedDict
from django.core.exceptions import FieldDoesNotExist, SuspiciousOperation, ImproperlyConfigured
from django.core.paginator import InvalidPage
from django.core.urlresolvers import reverse
from django.db import models
from django.utils import six
from django.utils.encoding import force_text
from django.utils.translation import ugettext, ugettext_lazy
from django.utils.http import urlencode
from django.contrib.admin import FieldListFilter from django.contrib.admin import FieldListFilter
from django.contrib.admin.exceptions import ( from django.contrib.admin.exceptions import (
DisallowedModelAdminLookup, DisallowedModelAdminToField, DisallowedModelAdminLookup, DisallowedModelAdminToField,
) )
from django.contrib.admin.options import IncorrectLookupParameters, IS_POPUP_VAR, TO_FIELD_VAR from django.contrib.admin.options import (
from django.contrib.admin.utils import (quote, get_fields_from_path, IS_POPUP_VAR, TO_FIELD_VAR, IncorrectLookupParameters,
lookup_needs_distinct, prepare_lookup_value) )
from django.contrib.admin.utils import (
get_fields_from_path, lookup_needs_distinct, prepare_lookup_value, quote,
)
from django.core.exceptions import (
FieldDoesNotExist, ImproperlyConfigured, SuspiciousOperation,
)
from django.core.paginator import InvalidPage
from django.core.urlresolvers import reverse
from django.db import models
from django.utils import six
from django.utils.encoding import force_text
from django.utils.http import urlencode
from django.utils.translation import ugettext, ugettext_lazy
# Changelist settings # Changelist settings
ALL_VAR = 'all' ALL_VAR = 'all'

View File

@ -9,15 +9,17 @@ from django import forms
from django.contrib.admin.templatetags.admin_static import static from django.contrib.admin.templatetags.admin_static import static
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.db.models.deletion import CASCADE from django.db.models.deletion import CASCADE
from django.forms.widgets import Media, RadioFieldRenderer
from django.forms.utils import flatatt from django.forms.utils import flatatt
from django.forms.widgets import Media, RadioFieldRenderer
from django.template.loader import render_to_string from django.template.loader import render_to_string
from django.utils.html import escape, format_html, format_html_join, smart_urlquote from django.utils import six
from django.utils.encoding import force_text
from django.utils.html import (
escape, format_html, format_html_join, smart_urlquote,
)
from django.utils.safestring import mark_safe
from django.utils.text import Truncator from django.utils.text import Truncator
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.utils.safestring import mark_safe
from django.utils.encoding import force_text
from django.utils import six
class FilteredSelectMultiple(forms.SelectMultiple): class FilteredSelectMultiple(forms.SelectMultiple):

View File

@ -1,5 +1,4 @@
from django.apps import AppConfig from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _

View File

@ -1,5 +1,5 @@
from django.conf import settings
from django import http from django import http
from django.conf import settings
class XViewMiddleware(object): class XViewMiddleware(object):

View File

@ -1,12 +1,13 @@
"Misc. utility functions/classes for admin documentation generator." "Misc. utility functions/classes for admin documentation generator."
import re import re
from email.parser import HeaderParser
from email.errors import HeaderParseError from email.errors import HeaderParseError
from email.parser import HeaderParser
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils.encoding import force_bytes from django.utils.encoding import force_bytes
from django.utils.safestring import mark_safe
try: try:
import docutils.core import docutils.core
import docutils.nodes import docutils.nodes

View File

@ -1,23 +1,25 @@
from importlib import import_module
import inspect import inspect
import os import os
import re import re
from importlib import import_module
from django.apps import apps from django.apps import apps
from django.conf import settings from django.conf import settings
from django.contrib import admin from django.contrib import admin
from django.contrib.admin.views.decorators import staff_member_required from django.contrib.admin.views.decorators import staff_member_required
from django.db import models
from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
from django.http import Http404
from django.core import urlresolvers
from django.contrib.admindocs import utils from django.contrib.admindocs import utils
from django.template.base import (builtins, get_library, from django.core import urlresolvers
get_templatetags_modules, InvalidTemplateLibrary, libraries) from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
from django.db import models
from django.http import Http404
from django.template.base import (
InvalidTemplateLibrary, builtins, get_library, get_templatetags_modules,
libraries,
)
from django.template.engine import Engine from django.template.engine import Engine
from django.utils.decorators import method_decorator
from django.utils._os import upath
from django.utils import six from django.utils import six
from django.utils._os import upath
from django.utils.decorators import method_decorator
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.views.generic import TemplateView from django.views.generic import TemplateView

View File

@ -1,19 +1,19 @@
from django.db import transaction
from django.conf import settings from django.conf import settings
from django.conf.urls import url from django.conf.urls import url
from django.contrib import admin from django.contrib import admin, messages
from django.contrib.admin.options import IS_POPUP_VAR from django.contrib.admin.options import IS_POPUP_VAR
from django.contrib.auth import update_session_auth_hash from django.contrib.auth import update_session_auth_hash
from django.contrib.auth.forms import (UserCreationForm, UserChangeForm, from django.contrib.auth.forms import (
AdminPasswordChangeForm) AdminPasswordChangeForm, UserChangeForm, UserCreationForm,
from django.contrib.auth.models import User, Group )
from django.contrib import messages from django.contrib.auth.models import Group, User
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.http import HttpResponseRedirect, Http404 from django.db import transaction
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from django.template.response import TemplateResponse from django.template.response import TemplateResponse
from django.utils.html import escape
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
from django.utils.html import escape
from django.utils.translation import ugettext, ugettext_lazy as _ from django.utils.translation import ugettext, ugettext_lazy as _
from django.views.decorators.csrf import csrf_protect from django.views.decorators.csrf import csrf_protect
from django.views.decorators.debug import sensitive_post_parameters from django.views.decorators.debug import sensitive_post_parameters

View File

@ -1,6 +1,6 @@
from django.apps import AppConfig from django.apps import AppConfig
from django.core import checks
from django.contrib.auth.checks import check_user_model from django.contrib.auth.checks import check_user_model
from django.core import checks
from django.db.models.signals import post_migrate from django.db.models.signals import post_migrate
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _

View File

@ -1,4 +1,5 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission from django.contrib.auth.models import Permission

View File

@ -1,10 +1,11 @@
from functools import wraps from functools import wraps
from django.conf import settings from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.shortcuts import resolve_url
from django.utils.decorators import available_attrs from django.utils.decorators import available_attrs
from django.utils.six.moves.urllib.parse import urlparse from django.utils.six.moves.urllib.parse import urlparse
from django.shortcuts import resolve_url
def user_passes_test(test_func, login_url=None, redirect_field_name=REDIRECT_FIELD_NAME): def user_passes_test(test_func, login_url=None, redirect_field_name=REDIRECT_FIELD_NAME):

View File

@ -3,6 +3,13 @@ from __future__ import unicode_literals
from collections import OrderedDict from collections import OrderedDict
from django import forms from django import forms
from django.contrib.auth import authenticate, get_user_model
from django.contrib.auth.hashers import (
UNUSABLE_PASSWORD_PREFIX, identify_hasher,
)
from django.contrib.auth.models import User
from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.shortcuts import get_current_site
from django.core.mail import EmailMultiAlternatives from django.core.mail import EmailMultiAlternatives
from django.forms.utils import flatatt from django.forms.utils import flatatt
from django.template import loader from django.template import loader
@ -13,12 +20,6 @@ from django.utils.safestring import mark_safe
from django.utils.text import capfirst from django.utils.text import capfirst
from django.utils.translation import ugettext, ugettext_lazy as _ from django.utils.translation import ugettext, ugettext_lazy as _
from django.contrib.auth import authenticate, get_user_model
from django.contrib.auth.models import User
from django.contrib.auth.hashers import UNUSABLE_PASSWORD_PREFIX, identify_hasher
from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.shortcuts import get_current_site
class ReadOnlyPasswordHashWidget(forms.Widget): class ReadOnlyPasswordHashWidget(forms.Widget):
def render(self, name, value, attrs): def render(self, name, value, attrs):

View File

@ -1,5 +1,5 @@
from django.contrib import auth
from django import db from django import db
from django.contrib import auth
from django.utils.encoding import force_bytes from django.utils.encoding import force_bytes

View File

@ -2,22 +2,22 @@ from __future__ import unicode_literals
import base64 import base64
import binascii import binascii
from collections import OrderedDict
import hashlib import hashlib
import importlib import importlib
from collections import OrderedDict
from django.dispatch import receiver
from django.conf import settings from django.conf import settings
from django.core.signals import setting_changed
from django.utils.encoding import force_bytes, force_str, force_text
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.utils.crypto import ( from django.core.signals import setting_changed
pbkdf2, constant_time_compare, get_random_string) from django.dispatch import receiver
from django.utils import lru_cache from django.utils import lru_cache
from django.utils.crypto import (
constant_time_compare, get_random_string, pbkdf2,
)
from django.utils.encoding import force_bytes, force_str, force_text
from django.utils.module_loading import import_string from django.utils.module_loading import import_string
from django.utils.translation import ugettext_noop as _ from django.utils.translation import ugettext_noop as _
UNUSABLE_PASSWORD_PREFIX = '!' # This will never be a valid encoded hash UNUSABLE_PASSWORD_PREFIX = '!' # This will never be a valid encoded hash
UNUSABLE_PASSWORD_SUFFIX_LENGTH = 40 # number of random chars to add after UNUSABLE_PASSWORD_PREFIX UNUSABLE_PASSWORD_SUFFIX_LENGTH = 40 # number of random chars to add after UNUSABLE_PASSWORD_PREFIX

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.core import validators
from django.db import models, migrations
from django.utils import timezone
import django.contrib.auth.models import django.contrib.auth.models
from django.core import validators
from django.db import migrations, models
from django.utils import timezone
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,21 +1,20 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.core.exceptions import PermissionDenied
from django.core.mail import send_mail
from django.core import validators
from django.db import models
from django.db.models.manager import EmptyManager
from django.utils.crypto import get_random_string, salted_hmac
from django.utils import six
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from django.contrib import auth from django.contrib import auth
from django.contrib.auth.hashers import ( from django.contrib.auth.hashers import (
check_password, make_password, is_password_usable) check_password, is_password_usable, make_password,
)
from django.contrib.auth.signals import user_logged_in from django.contrib.auth.signals import user_logged_in
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core import validators
from django.core.exceptions import PermissionDenied
from django.core.mail import send_mail
from django.db import models
from django.db.models.manager import EmptyManager
from django.utils import six, timezone
from django.utils.crypto import get_random_string, salted_hmac
from django.utils.encoding import python_2_unicode_compatible from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
def update_last_login(sender, user, **kwargs): def update_last_login(sender, user, **kwargs):

View File

@ -1,2 +1,4 @@
# For testing that auth backends can be referenced using a convenience import # For testing that auth backends can be referenced using a convenience import
from django.contrib.auth.tests.test_auth_backends import ImportedModelBackend # NOQA from django.contrib.auth.tests.test_auth_backends import ImportedModelBackend
__all__ = ['ImportedModelBackend']

View File

@ -1,13 +1,8 @@
from django.db import models
from django.contrib.auth.models import ( from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser, AbstractUser, BaseUserManager, Group, Permission,
AbstractBaseUser, PermissionsMixin, UserManager,
AbstractUser,
UserManager,
PermissionsMixin,
Group,
Permission,
) )
from django.db import models
# The custom User uses email as the unique identifier, and requires # The custom User uses email as the unique identifier, and requires

View File

@ -2,7 +2,6 @@ import os
from django.utils._os import upath from django.utils._os import upath
AUTH_MIDDLEWARE_CLASSES = [ AUTH_MIDDLEWARE_CLASSES = [
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',

View File

@ -1,16 +1,19 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from datetime import date from datetime import date
from django.contrib.auth import BACKEND_SESSION_KEY, authenticate, get_user
from django.contrib.auth.backends import ModelBackend from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User, Group, Permission, AnonymousUser from django.contrib.auth.hashers import MD5PasswordHasher
from django.contrib.auth.models import AnonymousUser, Group, Permission, User
from django.contrib.auth.tests.custom_user import (
CustomPermissionsUser, CustomUser, ExtensionUser,
)
from django.contrib.auth.tests.utils import skipIfCustomUser from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.auth.tests.custom_user import ExtensionUser, CustomPermissionsUser, CustomUser
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ImproperlyConfigured, PermissionDenied from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.contrib.auth import authenticate, BACKEND_SESSION_KEY, get_user
from django.http import HttpRequest from django.http import HttpRequest
from django.test import TestCase, modify_settings, override_settings from django.test import TestCase, modify_settings, override_settings
from django.contrib.auth.hashers import MD5PasswordHasher
class CountingMD5PasswordHasher(MD5PasswordHasher): class CountingMD5PasswordHasher(MD5PasswordHasher):

View File

@ -2,7 +2,7 @@ from __future__ import unicode_literals
from django.apps import apps from django.apps import apps
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.contrib.auth.models import User, AnonymousUser from django.contrib.auth.models import AnonymousUser, User
from django.contrib.auth.tests.custom_user import CustomUser from django.contrib.auth.tests.custom_user import CustomUser
from django.contrib.auth.tests.utils import skipIfCustomUser from django.contrib.auth.tests.utils import skipIfCustomUser
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured

View File

@ -1,7 +1,7 @@
from django.contrib.auth import authenticate from django.contrib.auth import authenticate
from django.contrib.auth.models import User, Permission from django.contrib.auth.context_processors import PermLookupDict, PermWrapper
from django.contrib.auth.models import Permission, User
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.context_processors import PermWrapper, PermLookupDict
from django.db.models import Q from django.db.models import Q
from django.test import TestCase, override_settings from django.test import TestCase, override_settings

View File

@ -3,16 +3,18 @@ from __future__ import unicode_literals
import re import re
from django import forms from django import forms
from django.contrib.auth.forms import (
AuthenticationForm, PasswordChangeForm, PasswordResetForm,
ReadOnlyPasswordHashField, ReadOnlyPasswordHashWidget, SetPasswordForm,
UserChangeForm, UserCreationForm,
)
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.auth.forms import (UserCreationForm, AuthenticationForm,
PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm,
ReadOnlyPasswordHashField, ReadOnlyPasswordHashWidget)
from django.core import mail from django.core import mail
from django.core.mail import EmailMultiAlternatives from django.core.mail import EmailMultiAlternatives
from django.forms.fields import Field, CharField from django.forms.fields import CharField, Field
from django.test import TestCase, override_settings from django.test import TestCase, override_settings
from django.utils.encoding import force_text
from django.utils import translation from django.utils import translation
from django.utils.encoding import force_text
from django.utils.text import capfirst from django.utils.text import capfirst
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _

View File

@ -1,11 +1,12 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.contrib.auth.handlers.modwsgi import check_password, groups_for_user from django.contrib.auth.handlers.modwsgi import (
from django.contrib.auth.models import User, Group check_password, groups_for_user,
)
from django.contrib.auth.models import Group, User
from django.contrib.auth.tests.custom_user import CustomUser from django.contrib.auth.tests.custom_user import CustomUser
from django.contrib.auth.tests.utils import skipIfCustomUser from django.contrib.auth.tests.utils import skipIfCustomUser
from django.test import TransactionTestCase from django.test import TransactionTestCase, override_settings
from django.test import override_settings
# This must be a TransactionTestCase because the WSGI auth handler performs # This must be a TransactionTestCase because the WSGI auth handler performs

View File

@ -4,14 +4,16 @@ from __future__ import unicode_literals
from unittest import skipUnless from unittest import skipUnless
from django.conf.global_settings import PASSWORD_HASHERS from django.conf.global_settings import PASSWORD_HASHERS
from django.contrib.auth.hashers import (is_password_usable, BasePasswordHasher, from django.contrib.auth.hashers import (
check_password, make_password, PBKDF2PasswordHasher, PBKDF2SHA1PasswordHasher, UNUSABLE_PASSWORD_PREFIX, UNUSABLE_PASSWORD_SUFFIX_LENGTH,
get_hasher, identify_hasher, UNUSABLE_PASSWORD_PREFIX, UNUSABLE_PASSWORD_SUFFIX_LENGTH) BasePasswordHasher, PBKDF2PasswordHasher, PBKDF2SHA1PasswordHasher,
check_password, get_hasher, identify_hasher, is_password_usable,
make_password,
)
from django.test import SimpleTestCase from django.test import SimpleTestCase
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils import six from django.utils import six
try: try:
import crypt import crypt
except ImportError: except ImportError:

View File

@ -1,23 +1,28 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from datetime import date
import locale import locale
import sys import sys
from datetime import date
from django.apps import apps from django.apps import apps
from django.contrib.auth import models, management from django.contrib.auth import management, models
from django.contrib.auth.checks import check_user_model from django.contrib.auth.checks import check_user_model
from django.contrib.auth.management import create_permissions from django.contrib.auth.management import create_permissions
from django.contrib.auth.management.commands import changepassword, createsuperuser from django.contrib.auth.management.commands import (
from django.contrib.auth.models import User, Group changepassword, createsuperuser,
from django.contrib.auth.tests.custom_user import CustomUser, CustomUserWithFK, Email )
from django.contrib.auth.models import Group, User
from django.contrib.auth.tests.custom_user import (
CustomUser, CustomUserWithFK, Email,
)
from django.contrib.auth.tests.utils import skipIfCustomUser from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core import checks from django.core import checks, exceptions
from django.core import exceptions
from django.core.management import call_command from django.core.management import call_command
from django.core.management.base import CommandError from django.core.management.base import CommandError
from django.test import TestCase, override_settings, override_system_checks, skipUnlessDBFeature from django.test import (
TestCase, override_settings, override_system_checks, skipUnlessDBFeature,
)
from django.utils import six from django.utils import six
from django.utils.encoding import force_str from django.utils.encoding import force_str

View File

@ -1,5 +1,7 @@
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.contrib.auth.models import AbstractUser, Group, Permission, User, UserManager from django.contrib.auth.models import (
AbstractUser, Group, Permission, User, UserManager,
)
from django.contrib.auth.tests.utils import skipIfCustomUser from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core import mail from django.core import mail

View File

@ -1,9 +1,8 @@
from django.contrib.auth import signals from django.contrib.auth import signals
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.auth.tests.utils import skipIfCustomUser from django.contrib.auth.tests.utils import skipIfCustomUser
from django.test import TestCase from django.test import TestCase, override_settings
from django.test.client import RequestFactory from django.test.client import RequestFactory
from django.test import override_settings
@skipIfCustomUser @skipIfCustomUser

View File

@ -3,11 +3,10 @@ from django.contrib.auth.models import User
from django.contrib.auth.tests.utils import skipIfCustomUser from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.auth.tokens import PasswordResetTokenGenerator from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.contrib.auth.views import ( from django.contrib.auth.views import (
password_reset, password_reset_done, password_reset_confirm, password_change, password_change_done, password_reset,
password_reset_complete, password_change, password_change_done, password_reset_complete, password_reset_confirm, password_reset_done,
) )
from django.test import RequestFactory, TestCase from django.test import RequestFactory, TestCase, override_settings
from django.test import override_settings
from django.utils.encoding import force_bytes, force_text from django.utils.encoding import force_bytes, force_text
from django.utils.http import urlsafe_base64_encode from django.utils.http import urlsafe_base64_encode

View File

@ -1,11 +1,11 @@
from datetime import date, timedelta
import sys import sys
import unittest import unittest
from datetime import date, timedelta
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.contrib.auth.tests.utils import skipIfCustomUser from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.test import TestCase from django.test import TestCase

View File

@ -1,33 +1,34 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from importlib import import_module
import itertools import itertools
import re import re
from importlib import import_module
from django.apps import apps from django.apps import apps
from django.conf import settings from django.conf import settings
from django.contrib.sites.requests import RequestSite
from django.contrib.admin.models import LogEntry from django.contrib.admin.models import LogEntry
from django.contrib.auth import SESSION_KEY, REDIRECT_FIELD_NAME from django.contrib.auth import REDIRECT_FIELD_NAME, SESSION_KEY
from django.contrib.auth.forms import (AuthenticationForm, PasswordChangeForm, from django.contrib.auth.forms import (
SetPasswordForm) AuthenticationForm, PasswordChangeForm, SetPasswordForm,
)
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.auth.views import login as login_view, redirect_to_login from django.contrib.auth.views import login as login_view, redirect_to_login
from django.contrib.sessions.middleware import SessionMiddleware
from django.contrib.sites.requests import RequestSite
from django.core import mail from django.core import mail
from django.core.urlresolvers import NoReverseMatch, reverse, reverse_lazy from django.core.urlresolvers import NoReverseMatch, reverse, reverse_lazy
from django.http import QueryDict, HttpRequest from django.http import HttpRequest, QueryDict
from django.utils.deprecation import RemovedInDjango20Warning from django.middleware.csrf import CsrfViewMiddleware
from django.utils.encoding import force_text
from django.utils.http import urlquote
from django.utils.six.moves.urllib.parse import urlparse, ParseResult
from django.utils.translation import LANGUAGE_SESSION_KEY
from django.test import ( from django.test import (
TestCase, ignore_warnings, modify_settings, override_settings, TestCase, ignore_warnings, modify_settings, override_settings,
) )
from django.test.utils import patch_logger from django.test.utils import patch_logger
from django.middleware.csrf import CsrfViewMiddleware from django.utils.deprecation import RemovedInDjango20Warning
from django.contrib.sessions.middleware import SessionMiddleware from django.utils.encoding import force_text
from django.utils.http import urlquote
from django.utils.six.moves.urllib.parse import ParseResult, urlparse
from django.utils.translation import LANGUAGE_SESSION_KEY
# Needed so model is installed when tests are run independently: # Needed so model is installed when tests are run independently:
from .custom_user import CustomUser # NOQA from .custom_user import CustomUser # NOQA

View File

@ -1,13 +1,13 @@
from django.conf.urls import url, include from django.conf.urls import include, url
from django.contrib import admin from django.contrib import admin
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.urls import urlpatterns
from django.contrib.auth import views from django.contrib.auth import views
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.urls import urlpatterns
from django.contrib.messages.api import info from django.contrib.messages.api import info
from django.http import HttpResponse, HttpRequest from django.http import HttpRequest, HttpResponse
from django.shortcuts import render from django.shortcuts import render
from django.template import Template, RequestContext from django.template import RequestContext, Template
from django.views.decorators.cache import never_cache from django.views.decorators.cache import never_cache

View File

@ -4,8 +4,8 @@ Test URLs for auth admins.
from django.conf.urls import include, url from django.conf.urls import include, url
from django.contrib import admin from django.contrib import admin
from django.contrib.auth.admin import UserAdmin, GroupAdmin from django.contrib.auth.admin import GroupAdmin, UserAdmin
from django.contrib.auth.models import User, Group from django.contrib.auth.models import Group, User
from django.contrib.auth.urls import urlpatterns from django.contrib.auth.urls import urlpatterns
# Create a silo'd admin site for just the user/group admins. # Create a silo'd admin site for just the user/group admins.

View File

@ -1,8 +1,9 @@
from datetime import date from datetime import date
from django.conf import settings 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
from django.utils import six from django.utils import six
from django.utils.crypto import constant_time_compare, salted_hmac
from django.utils.http import base36_to_int, int_to_base36
class PasswordResetTokenGenerator(object): class PasswordResetTokenGenerator(object):

View File

@ -1,25 +1,31 @@
import warnings import warnings
from django.conf import settings from django.conf import settings
# Avoid shadowing the login() and logout() views below.
from django.contrib.auth import (
REDIRECT_FIELD_NAME, get_user_model, login as auth_login,
logout as auth_logout, update_session_auth_hash,
)
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import (
AuthenticationForm, PasswordChangeForm, PasswordResetForm, SetPasswordForm,
)
from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.shortcuts import get_current_site
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, QueryDict from django.http import HttpResponseRedirect, QueryDict
from django.shortcuts import resolve_url
from django.template.response import TemplateResponse from django.template.response import TemplateResponse
from django.utils.deprecation import RemovedInDjango20Warning from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.http import is_safe_url, urlsafe_base64_decode from django.utils.http import is_safe_url, urlsafe_base64_decode
from django.utils.translation import ugettext as _
from django.utils.six.moves.urllib.parse import urlparse, urlunparse from django.utils.six.moves.urllib.parse import urlparse, urlunparse
from django.shortcuts import resolve_url from django.utils.translation import ugettext as _
from django.views.decorators.debug import sensitive_post_parameters
from django.views.decorators.cache import never_cache from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_protect from django.views.decorators.csrf import csrf_protect
from django.views.decorators.debug import sensitive_post_parameters
# Avoid shadowing the login() and logout() views below. # Avoid shadowing the login() and logout() views below.
from django.contrib.auth import (REDIRECT_FIELD_NAME, login as auth_login,
logout as auth_logout, get_user_model, update_session_auth_hash)
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AuthenticationForm, PasswordResetForm, SetPasswordForm, PasswordChangeForm
from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.shortcuts import get_current_site
@sensitive_post_parameters() @sensitive_post_parameters()

View File

@ -6,7 +6,7 @@ from django.contrib.admin.checks import InlineModelAdminChecks
from django.contrib.admin.options import InlineModelAdmin, flatten_fieldsets from django.contrib.admin.options import InlineModelAdmin, flatten_fieldsets
from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.forms import ( from django.contrib.contenttypes.forms import (
BaseGenericInlineFormSet, generic_inlineformset_factory BaseGenericInlineFormSet, generic_inlineformset_factory,
) )
from django.core import checks from django.core import checks
from django.core.exceptions import FieldDoesNotExist from django.core.exceptions import FieldDoesNotExist

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.utils import six
from django.apps import apps from django.apps import apps
from django.utils import six
def check_generic_foreign_keys(**kwargs): def check_generic_foreign_keys(**kwargs):

View File

@ -2,16 +2,15 @@ from __future__ import unicode_literals
from collections import defaultdict from collections import defaultdict
from django.contrib.contenttypes.models import ContentType
from django.core import checks from django.core import checks
from django.core.exceptions import FieldDoesNotExist, ObjectDoesNotExist from django.core.exceptions import FieldDoesNotExist, ObjectDoesNotExist
from django.db import connection from django.db import DEFAULT_DB_ALIAS, connection, models, router, transaction
from django.db import models, router, transaction, DEFAULT_DB_ALIAS from django.db.models import DO_NOTHING, signals
from django.db.models import signals, DO_NOTHING
from django.db.models.base import ModelBase from django.db.models.base import ModelBase
from django.db.models.fields.related import ForeignObject, ForeignObjectRel from django.db.models.fields.related import ForeignObject, ForeignObjectRel
from django.db.models.query_utils import PathInfo from django.db.models.query_utils import PathInfo
from django.contrib.contenttypes.models import ContentType from django.utils.encoding import python_2_unicode_compatible, smart_text
from django.utils.encoding import smart_text, python_2_unicode_compatible
@python_2_unicode_compatible @python_2_unicode_compatible

View File

@ -1,9 +1,9 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.contrib.contenttypes.models import ContentType
from django.db import models from django.db import models
from django.forms import ModelForm, modelformset_factory from django.forms import ModelForm, modelformset_factory
from django.forms.models import BaseModelFormSet from django.forms.models import BaseModelFormSet
from django.contrib.contenttypes.models import ContentType
class BaseGenericInlineFormSet(BaseModelFormSet): class BaseGenericInlineFormSet(BaseModelFormSet):

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations
import django.contrib.contenttypes.models import django.contrib.contenttypes.models
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
def add_legacy_name(apps, schema_editor): def add_legacy_name(apps, schema_editor):

View File

@ -5,9 +5,9 @@ import warnings
from django.apps import apps from django.apps import apps
from django.db import models from django.db import models
from django.db.utils import OperationalError, ProgrammingError from django.db.utils import OperationalError, ProgrammingError
from django.utils.translation import ugettext_lazy as _
from django.utils.deprecation import RemovedInDjango20Warning from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.encoding import force_text, python_2_unicode_compatible from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
class ContentTypeManager(models.Manager): class ContentTypeManager(models.Manager):

View File

@ -6,11 +6,14 @@ from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.views import shortcut from django.contrib.contenttypes.views import shortcut
from django.contrib.sites.shortcuts import get_current_site from django.contrib.sites.shortcuts import get_current_site
from django.core.management import call_command from django.core.management import call_command
from django.http import HttpRequest, Http404 from django.http import Http404, HttpRequest
from django.test import TestCase, override_settings, skipUnlessDBFeature from django.test import TestCase, override_settings, skipUnlessDBFeature
from django.utils import six from django.utils import six
from .models import ConcreteModel, ProxyModel, FooWithoutUrl, FooWithUrl, FooWithBrokenAbsoluteUrl from .models import (
ConcreteModel, FooWithBrokenAbsoluteUrl, FooWithoutUrl, FooWithUrl,
ProxyModel,
)
class ContentTypesTests(TestCase): class ContentTypesTests(TestCase):

View File

@ -1,7 +1,7 @@
from django.contrib import admin from django.contrib import admin
from django.contrib.flatpages.forms import FlatpageForm
from django.contrib.flatpages.models import FlatPage from django.contrib.flatpages.models import FlatPage
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.contrib.flatpages.forms import FlatpageForm
class FlatPageAdmin(admin.ModelAdmin): class FlatPageAdmin(admin.ModelAdmin):

View File

@ -1,5 +1,4 @@
from django.apps import AppConfig from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _

View File

@ -1,6 +1,6 @@
from django.conf import settings
from django.contrib.flatpages.views import flatpage from django.contrib.flatpages.views import flatpage
from django.http import Http404 from django.http import Http404
from django.conf import settings
class FlatpageFallbackMiddleware(object): class FlatpageFallbackMiddleware(object):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,10 +1,10 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.core.urlresolvers import get_script_prefix from django.core.urlresolvers import get_script_prefix
from django.utils.translation import ugettext_lazy as _ from django.db import models
from django.utils.encoding import iri_to_uri, python_2_unicode_compatible from django.utils.encoding import iri_to_uri, python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
@python_2_unicode_compatible @python_2_unicode_compatible

View File

@ -3,7 +3,6 @@ from django.conf import settings
from django.contrib.flatpages.models import FlatPage from django.contrib.flatpages.models import FlatPage
from django.contrib.sites.shortcuts import get_current_site from django.contrib.sites.shortcuts import get_current_site
register = template.Library() register = template.Library()

View File

@ -1,6 +1,5 @@
import os import os
FLATPAGES_TEMPLATES = [{ FLATPAGES_TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(os.path.dirname(__file__), 'templates')], 'DIRS': [os.path.join(os.path.dirname(__file__), 'templates')],

View File

@ -1,7 +1,6 @@
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.auth.tests.utils import skipIfCustomUser from django.contrib.auth.tests.utils import skipIfCustomUser
from django.test import TestCase, Client from django.test import Client, TestCase, override_settings
from django.test import override_settings
from .settings import FLATPAGES_TEMPLATES from .settings import FLATPAGES_TEMPLATES

View File

@ -2,8 +2,8 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.core.urlresolvers import set_script_prefix, clear_script_prefix
from django.contrib.flatpages.models import FlatPage from django.contrib.flatpages.models import FlatPage
from django.core.urlresolvers import clear_script_prefix, set_script_prefix
from django.test import TestCase from django.test import TestCase

View File

@ -1,6 +1,6 @@
from django.contrib.auth.models import AnonymousUser, User from django.contrib.auth.models import AnonymousUser, User
from django.contrib.auth.tests.utils import skipIfCustomUser from django.contrib.auth.tests.utils import skipIfCustomUser
from django.template import Template, Context, TemplateSyntaxError from django.template import Context, Template, TemplateSyntaxError
from django.test import TestCase, override_settings from django.test import TestCase, override_settings
from .settings import FLATPAGES_TEMPLATES from .settings import FLATPAGES_TEMPLATES

View File

@ -1,7 +1,7 @@
from django.contrib.admin import ModelAdmin from django.contrib.admin import ModelAdmin
from django.contrib.gis.admin.widgets import OpenLayersWidget from django.contrib.gis.admin.widgets import OpenLayersWidget
from django.contrib.gis.gdal import HAS_GDAL, OGRGeomType
from django.contrib.gis.db import models from django.contrib.gis.db import models
from django.contrib.gis.gdal import HAS_GDAL, OGRGeomType
class GeoModelAdmin(ModelAdmin): class GeoModelAdmin(ModelAdmin):

View File

@ -1,12 +1,10 @@
import logging import logging
from django.contrib.gis.gdal import GDALException
from django.contrib.gis.geos import GEOSException, GEOSGeometry
from django.forms.widgets import Textarea from django.forms.widgets import Textarea
from django.template import loader from django.template import loader
from django.utils import six from django.utils import six, translation
from django.utils import translation
from django.contrib.gis.gdal import GDALException
from django.contrib.gis.geos import GEOSGeometry, GEOSException
# Creating a template context that contains Django settings # Creating a template context that contains Django settings
# values needed by admin map templates. # values needed by admin map templates.

View File

@ -1,6 +1,5 @@
from django.apps import AppConfig from django.apps import AppConfig
from django.core import serializers from django.core import serializers
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _

View File

@ -1,4 +1,5 @@
from django.db.backends.mysql.base import DatabaseWrapper as MySQLDatabaseWrapper from django.db.backends.mysql.base import \
DatabaseWrapper as MySQLDatabaseWrapper
from .features import DatabaseFeatures from .features import DatabaseFeatures
from .introspection import MySQLIntrospection from .introspection import MySQLIntrospection

View File

@ -1,5 +1,6 @@
from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures
from django.db.backends.mysql.features import DatabaseFeatures as MySQLDatabaseFeatures from django.db.backends.mysql.features import \
DatabaseFeatures as MySQLDatabaseFeatures
class DatabaseFeatures(BaseSpatialFeatures, MySQLDatabaseFeatures): class DatabaseFeatures(BaseSpatialFeatures, MySQLDatabaseFeatures):

View File

@ -1,5 +1,6 @@
from django.contrib.gis.db.backends.base.adapter import WKTAdapter from django.contrib.gis.db.backends.base.adapter import WKTAdapter
from django.contrib.gis.db.backends.base.operations import BaseSpatialOperations from django.contrib.gis.db.backends.base.operations import \
BaseSpatialOperations
from django.contrib.gis.db.backends.utils import SpatialOperator from django.contrib.gis.db.backends.utils import SpatialOperator
from django.contrib.gis.db.models import aggregates from django.contrib.gis.db.models import aggregates
from django.db.backends.mysql.operations import DatabaseOperations from django.db.backends.mysql.operations import DatabaseOperations

View File

@ -1,8 +1,8 @@
import logging import logging
from django.contrib.gis.db.models.fields import GeometryField from django.contrib.gis.db.models.fields import GeometryField
from django.db.utils import OperationalError
from django.db.backends.mysql.schema import DatabaseSchemaEditor from django.db.backends.mysql.schema import DatabaseSchemaEditor
from django.db.utils import OperationalError
logger = logging.getLogger('django.contrib.gis') logger = logging.getLogger('django.contrib.gis')

View File

@ -1,4 +1,5 @@
from cx_Oracle import CLOB from cx_Oracle import CLOB
from django.contrib.gis.db.backends.base.adapter import WKTAdapter from django.contrib.gis.db.backends.base.adapter import WKTAdapter

View File

@ -1,4 +1,5 @@
from django.db.backends.oracle.base import DatabaseWrapper as OracleDatabaseWrapper from django.db.backends.oracle.base import \
DatabaseWrapper as OracleDatabaseWrapper
from .features import DatabaseFeatures from .features import DatabaseFeatures
from .introspection import OracleIntrospection from .introspection import OracleIntrospection

View File

@ -1,5 +1,6 @@
from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures
from django.db.backends.oracle.features import DatabaseFeatures as OracleDatabaseFeatures from django.db.backends.oracle.features import \
DatabaseFeatures as OracleDatabaseFeatures
class DatabaseFeatures(BaseSpatialFeatures, OracleDatabaseFeatures): class DatabaseFeatures(BaseSpatialFeatures, OracleDatabaseFeatures):

View File

@ -1,5 +1,7 @@
import cx_Oracle
import sys import sys
import cx_Oracle
from django.db.backends.oracle.introspection import DatabaseIntrospection from django.db.backends.oracle.introspection import DatabaseIntrospection
from django.utils import six from django.utils import six

View File

@ -9,7 +9,8 @@
""" """
import re import re
from django.contrib.gis.db.backends.base.operations import BaseSpatialOperations from django.contrib.gis.db.backends.base.operations import \
BaseSpatialOperations
from django.contrib.gis.db.backends.oracle.adapter import OracleSpatialAdapter from django.contrib.gis.db.backends.oracle.adapter import OracleSpatialAdapter
from django.contrib.gis.db.backends.utils import SpatialOperator from django.contrib.gis.db.backends.utils import SpatialOperator
from django.contrib.gis.db.models import aggregates from django.contrib.gis.db.models import aggregates
@ -19,7 +20,6 @@ from django.db.backends.oracle.base import Database
from django.db.backends.oracle.operations import DatabaseOperations from django.db.backends.oracle.operations import DatabaseOperations
from django.utils import six from django.utils import six
DEFAULT_TOLERANCE = '0.05' DEFAULT_TOLERANCE = '0.05'

View File

@ -1,8 +1,7 @@
from django.conf import settings from django.conf import settings
from django.db.backends.base.base import NO_DB_ALIAS from django.db.backends.base.base import NO_DB_ALIAS
from django.db.backends.postgresql_psycopg2.base import ( from django.db.backends.postgresql_psycopg2.base import \
DatabaseWrapper as Psycopg2DatabaseWrapper, DatabaseWrapper as Psycopg2DatabaseWrapper
)
from django.utils.functional import cached_property from django.utils.functional import cached_property
from .creation import PostGISCreation from .creation import PostGISCreation

View File

@ -1,7 +1,6 @@
from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures
from django.db.backends.postgresql_psycopg2.features import ( from django.db.backends.postgresql_psycopg2.features import \
DatabaseFeatures as Psycopg2DatabaseFeatures, DatabaseFeatures as Psycopg2DatabaseFeatures
)
class DatabaseFeatures(BaseSpatialFeatures, Psycopg2DatabaseFeatures): class DatabaseFeatures(BaseSpatialFeatures, Psycopg2DatabaseFeatures):

View File

@ -1,5 +1,6 @@
from django.db.backends.postgresql_psycopg2.introspection import DatabaseIntrospection
from django.contrib.gis.gdal import OGRGeomType from django.contrib.gis.gdal import OGRGeomType
from django.db.backends.postgresql_psycopg2.introspection import \
DatabaseIntrospection
class GeoIntrospectionError(Exception): class GeoIntrospectionError(Exception):

View File

@ -1,8 +1,8 @@
""" """
The GeometryColumns and SpatialRefSys models for the PostGIS backend. The GeometryColumns and SpatialRefSys models for the PostGIS backend.
""" """
from django.db import models
from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin
from django.db import models
from django.utils.encoding import python_2_unicode_compatible from django.utils.encoding import python_2_unicode_compatible

View File

@ -1,13 +1,15 @@
import re import re
from django.conf import settings from django.conf import settings
from django.contrib.gis.db.backends.base.operations import BaseSpatialOperations from django.contrib.gis.db.backends.base.operations import \
BaseSpatialOperations
from django.contrib.gis.db.backends.postgis.adapter import PostGISAdapter from django.contrib.gis.db.backends.postgis.adapter import PostGISAdapter
from django.contrib.gis.db.backends.utils import SpatialOperator from django.contrib.gis.db.backends.utils import SpatialOperator
from django.contrib.gis.geometry.backend import Geometry from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.measure import Distance from django.contrib.gis.measure import Distance
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.db.backends.postgresql_psycopg2.operations import DatabaseOperations from django.db.backends.postgresql_psycopg2.operations import \
DatabaseOperations
from django.db.utils import ProgrammingError from django.db.utils import ProgrammingError
from django.utils.functional import cached_property from django.utils.functional import cached_property

View File

@ -1,5 +1,5 @@
from django.db.backends.sqlite3.base import Database
from django.contrib.gis.db.backends.base.adapter import WKTAdapter from django.contrib.gis.db.backends.base.adapter import WKTAdapter
from django.db.backends.sqlite3.base import Database
class SpatiaLiteAdapter(WKTAdapter): class SpatiaLiteAdapter(WKTAdapter):

View File

@ -1,5 +1,6 @@
from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures
from django.db.backends.sqlite3.features import DatabaseFeatures as SQLiteDatabaseFeatures from django.db.backends.sqlite3.features import \
DatabaseFeatures as SQLiteDatabaseFeatures
from django.utils.functional import cached_property from django.utils.functional import cached_property

View File

@ -1,5 +1,7 @@
from django.contrib.gis.gdal import OGRGeomType from django.contrib.gis.gdal import OGRGeomType
from django.db.backends.sqlite3.introspection import DatabaseIntrospection, FlexibleFieldLookupDict from django.db.backends.sqlite3.introspection import (
DatabaseIntrospection, FlexibleFieldLookupDict,
)
from django.utils import six from django.utils import six

View File

@ -1,10 +1,10 @@
""" """
The GeometryColumns and SpatialRefSys models for the SpatiaLite backend. The GeometryColumns and SpatialRefSys models for the SpatiaLite backend.
""" """
from django.db import connection, models
from django.db.backends.signals import connection_created
from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin
from django.contrib.gis.db.backends.spatialite.base import DatabaseWrapper from django.contrib.gis.db.backends.spatialite.base import DatabaseWrapper
from django.db import connection, models
from django.db.backends.signals import connection_created
from django.utils.encoding import python_2_unicode_compatible from django.utils.encoding import python_2_unicode_compatible

View File

@ -1,9 +1,10 @@
import re import re
import sys import sys
from django.contrib.gis.db.backends.base.operations import BaseSpatialOperations from django.contrib.gis.db.backends.base.operations import \
from django.contrib.gis.db.backends.utils import SpatialOperator BaseSpatialOperations
from django.contrib.gis.db.backends.spatialite.adapter import SpatiaLiteAdapter from django.contrib.gis.db.backends.spatialite.adapter import SpatiaLiteAdapter
from django.contrib.gis.db.backends.utils import SpatialOperator
from django.contrib.gis.db.models import aggregates from django.contrib.gis.db.models import aggregates
from django.contrib.gis.geometry.backend import Geometry from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.measure import Distance from django.contrib.gis.measure import Distance

View File

@ -1,5 +1,5 @@
from django.db.utils import DatabaseError
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
from django.db.utils import DatabaseError
class SpatialiteSchemaEditor(DatabaseSchemaEditor): class SpatialiteSchemaEditor(DatabaseSchemaEditor):

View File

@ -1,5 +1,5 @@
from django.db.models.aggregates import Aggregate
from django.contrib.gis.db.models.fields import ExtentField from django.contrib.gis.db.models.fields import ExtentField
from django.db.models.aggregates import Aggregate
__all__ = ['Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union'] __all__ = ['Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union']

View File

@ -1,11 +1,11 @@
from django.db.models.fields import Field
from django.db.models.expressions import ExpressionNode
from django.utils.translation import ugettext_lazy as _
from django.contrib.gis import forms from django.contrib.gis import forms
from django.contrib.gis.db.models.lookups import gis_lookups from django.contrib.gis.db.models.lookups import gis_lookups
from django.contrib.gis.db.models.proxy import GeometryProxy from django.contrib.gis.db.models.proxy import GeometryProxy
from django.contrib.gis.geometry.backend import Geometry, GeometryException from django.contrib.gis.geometry.backend import Geometry, GeometryException
from django.db.models.expressions import ExpressionNode
from django.db.models.fields import Field
from django.utils import six from django.utils import six
from django.utils.translation import ugettext_lazy as _
# Local cache of the spatial_ref_sys table, which holds SRID data for each # Local cache of the spatial_ref_sys table, which holds SRID data for each
# spatial database alias. This cache exists so that the database isn't queried # spatial database alias. This cache exists so that the database isn't queried

View File

@ -1,10 +1,11 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import re import re
from django.core.exceptions import FieldDoesNotExist from django.core.exceptions import FieldDoesNotExist
from django.db.models.constants import LOOKUP_SEP from django.db.models.constants import LOOKUP_SEP
from django.db.models.expressions import Col, ExpressionNode
from django.db.models.lookups import Lookup from django.db.models.lookups import Lookup
from django.db.models.expressions import ExpressionNode, Col
from django.utils import six from django.utils import six
gis_lookups = {} gis_lookups = {}

View File

@ -1,5 +1,5 @@
from django.db.models.manager import Manager
from django.contrib.gis.db.models.query import GeoQuerySet from django.contrib.gis.db.models.query import GeoQuerySet
from django.db.models.manager import Manager
class GeoManager(Manager.from_queryset(GeoQuerySet)): class GeoManager(Manager.from_queryset(GeoQuerySet)):

View File

@ -1,13 +1,8 @@
import warnings import warnings
from django.db import connections
from django.db.models.expressions import RawSQL
from django.db.models.fields import Field
from django.db.models.query import QuerySet
from django.contrib.gis.db.models import aggregates from django.contrib.gis.db.models import aggregates
from django.contrib.gis.db.models.fields import ( from django.contrib.gis.db.models.fields import (
get_srid_info, LineStringField, GeometryField, PointField, GeometryField, LineStringField, PointField, get_srid_info,
) )
from django.contrib.gis.db.models.lookups import GISLookup from django.contrib.gis.db.models.lookups import GISLookup
from django.contrib.gis.db.models.sql import ( from django.contrib.gis.db.models.sql import (
@ -15,7 +10,10 @@ from django.contrib.gis.db.models.sql import (
) )
from django.contrib.gis.geometry.backend import Geometry from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.measure import Area, Distance from django.contrib.gis.measure import Area, Distance
from django.db import connections
from django.db.models.expressions import RawSQL
from django.db.models.fields import Field
from django.db.models.query import QuerySet
from django.utils import six from django.utils import six
from django.utils.deprecation import RemovedInDjango20Warning from django.utils.deprecation import RemovedInDjango20Warning

Some files were not shown because too many files have changed in this diff Show More