From 49cfe253991bd255e3293da545ba9af00ab6e18f Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Thu, 3 Mar 2011 01:54:33 +0000 Subject: [PATCH] Fixed #15512 -- Cleanup of imports in contrib.admin. Thanks to Julien Phalip for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15719 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/admin/helpers.py | 4 ++-- django/contrib/admin/options.py | 7 +++---- django/contrib/admin/sites.py | 6 +++--- django/contrib/admin/templatetags/admin_list.py | 4 ++-- django/contrib/admin/util.py | 3 +-- django/contrib/admin/validation.py | 4 ++-- django/contrib/admin/views/decorators.py | 3 --- django/contrib/admin/views/main.py | 2 +- 8 files changed, 14 insertions(+), 19 deletions(-) diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py index a0eda384f0..0055e83190 100644 --- a/django/contrib/admin/helpers.py +++ b/django/contrib/admin/helpers.py @@ -1,7 +1,7 @@ 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, help_text_for_field +from django.contrib.admin.util import (flatten_fieldsets, lookup_field, + display_for_field, label_for_field, help_text_for_field) from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ObjectDoesNotExist from django.db.models.fields.related import ManyToManyRel diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index 142ce3be5f..43c5503f99 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -1,10 +1,9 @@ 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.forms.models import (modelform_factory, modelformset_factory, + inlineformset_factory, BaseInlineFormSet) from django.contrib.contenttypes.models import ContentType -from django.contrib.admin import widgets -from django.contrib.admin import helpers +from django.contrib.admin import widgets, helpers from django.contrib.admin.util import unquote, flatten_fieldsets, get_deleted_objects, model_format_dict from django.contrib import messages from django.views.decorators.csrf import csrf_protect diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py index 4b6e3cad87..b03bce455e 100644 --- a/django/contrib/admin/sites.py +++ b/django/contrib/admin/sites.py @@ -1,8 +1,8 @@ import re from django import http, template from django.contrib.admin import ModelAdmin, actions -from django.contrib.admin.forms import AdminAuthenticationForm, ERROR_MESSAGE -from django.contrib.auth import REDIRECT_FIELD_NAME, authenticate, login +from django.contrib.admin.forms import AdminAuthenticationForm +from django.contrib.auth import REDIRECT_FIELD_NAME from django.contrib.contenttypes import views as contenttype_views from django.views.decorators.csrf import csrf_protect from django.db.models.base import ModelBase @@ -12,7 +12,7 @@ from django.shortcuts import render_to_response from django.utils.functional import update_wrapper from django.utils.safestring import mark_safe from django.utils.text import capfirst -from django.utils.translation import ugettext_lazy, ugettext as _ +from django.utils.translation import ugettext as _ from django.views.decorators.cache import never_cache from django.conf import settings diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py index bbe4b649f5..371b6a2b5a 100644 --- a/django/contrib/admin/templatetags/admin_list.py +++ b/django/contrib/admin/templatetags/admin_list.py @@ -2,8 +2,8 @@ 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 django.contrib.admin.views.main import (ALL_VAR, EMPTY_CHANGELIST_VALUE, + ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SEARCH_VAR) from django.core.exceptions import ObjectDoesNotExist from django.db import models from django.utils import formats diff --git a/django/contrib/admin/util.py b/django/contrib/admin/util.py index d0a5293210..e98ec7b884 100644 --- a/django/contrib/admin/util.py +++ b/django/contrib/admin/util.py @@ -9,8 +9,7 @@ from django.utils.safestring import mark_safe from django.utils.text import capfirst from django.utils.encoding import force_unicode, smart_unicode, smart_str from django.utils.translation import ungettext -from django.core.urlresolvers import reverse, NoReverseMatch -from django.utils.datastructures import SortedDict +from django.core.urlresolvers import reverse def quote(s): diff --git a/django/contrib/admin/validation.py b/django/contrib/admin/validation.py index e0db936df4..159afa4f05 100644 --- a/django/contrib/admin/validation.py +++ b/django/contrib/admin/validation.py @@ -4,8 +4,8 @@ from django.db.models.fields import FieldDoesNotExist from django.forms.models import (BaseModelForm, BaseModelFormSet, fields_for_model, _get_foreign_key) from django.contrib.admin.util import get_fields_from_path, NotRelationField -from django.contrib.admin.options import flatten_fieldsets, BaseModelAdmin -from django.contrib.admin.options import HORIZONTAL, VERTICAL +from django.contrib.admin.options import (flatten_fieldsets, BaseModelAdmin, + HORIZONTAL, VERTICAL) __all__ = ['validate'] diff --git a/django/contrib/admin/views/decorators.py b/django/contrib/admin/views/decorators.py index 1f5f20d605..9088eb0494 100644 --- a/django/contrib/admin/views/decorators.py +++ b/django/contrib/admin/views/decorators.py @@ -3,10 +3,7 @@ try: except ImportError: from django.utils.functional import wraps # Python 2.4 fallback. -from django import template -from django.shortcuts import render_to_response from django.utils.translation import ugettext as _ - from django.contrib.admin.forms import AdminAuthenticationForm from django.contrib.auth.views import login from django.contrib.auth import REDIRECT_FIELD_NAME diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py index 823c22e46f..170d168787 100644 --- a/django/contrib/admin/views/main.py +++ b/django/contrib/admin/views/main.py @@ -2,7 +2,7 @@ from django.contrib.admin.filterspecs import FilterSpec from django.contrib.admin.options import IncorrectLookupParameters from django.contrib.admin.util import quote, get_fields_from_path from django.core.exceptions import SuspiciousOperation -from django.core.paginator import Paginator, InvalidPage +from django.core.paginator import InvalidPage from django.db import models from django.utils.encoding import force_unicode, smart_str from django.utils.translation import ugettext, ugettext_lazy