From a2814846ca006b4fbf3a893ec52cd9d444b3a3eb Mon Sep 17 00:00:00 2001 From: Loic Bistuer Date: Mon, 9 Dec 2013 00:20:06 +0700 Subject: [PATCH] Fixed E124 pep8 warnings. --- django/contrib/admin/helpers.py | 3 +- django/contrib/admin/options.py | 6 +- django/contrib/admin/sites.py | 3 +- .../contrib/admin/templatetags/admin_list.py | 3 +- django/contrib/admindocs/tests/test_fields.py | 3 +- django/contrib/admindocs/urls.py | 27 +-- django/contrib/auth/admin.py | 4 +- django/contrib/auth/tests/test_basic.py | 15 +- django/contrib/auth/tests/test_management.py | 15 +- django/contrib/contenttypes/generic.py | 7 +- django/contrib/gis/db/models/query.py | 25 +-- django/contrib/gis/forms/widgets.py | 3 +- .../contrib/gis/tests/geoapp/test_regress.py | 9 +- django/core/management/commands/testserver.py | 3 +- django/core/management/validation.py | 12 +- django/db/backends/__init__.py | 3 +- django/db/backends/mysql/base.py | 8 +- .../db/backends/postgresql_psycopg2/base.py | 3 +- django/db/migrations/optimizer.py | 114 +++++++----- django/db/models/fields/__init__.py | 3 +- django/db/models/fields/related.py | 3 +- django/forms/utils.py | 18 +- django/forms/widgets.py | 2 +- django/test/__init__.py | 3 +- django/test/simple.py | 3 +- django/utils/text.py | 3 +- setup.cfg | 2 +- tests/createsuperuser/tests.py | 3 +- tests/custom_columns/tests.py | 3 +- tests/custom_pk/tests.py | 3 +- tests/extra_regress/tests.py | 29 +-- tests/get_object_or_404/tests.py | 21 ++- tests/get_or_create/tests.py | 9 +- tests/inline_formsets/tests.py | 9 +- tests/m2m_regress/tests.py | 3 +- tests/many_to_one/tests.py | 5 +- tests/middleware_exceptions/tests.py | 4 +- tests/model_validation/tests.py | 14 +- tests/modeladmin/tests.py | 174 ++++++++++++------ tests/proxy_models/tests.py | 18 +- tests/raw_query/tests.py | 4 +- tests/select_related/tests.py | 13 +- tests/staticfiles_tests/tests.py | 6 +- tests/template_tests/test_parser.py | 8 +- tests/test_utils/tests.py | 4 +- 45 files changed, 371 insertions(+), 262 deletions(-) diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py index a2a7df945a..318c393c09 100644 --- a/django/contrib/admin/helpers.py +++ b/django/contrib/admin/helpers.py @@ -42,7 +42,8 @@ class AdminForm(object): def __iter__(self): for name, options in self.fieldsets: - yield Fieldset(self.form, name, + yield Fieldset( + self.form, name, readonly_fields=self.readonly_fields, model_admin=self.model_admin, **options diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index 51e8a1b2e6..4c5adaf0f8 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -1520,7 +1520,8 @@ class ModelAdmin(BaseModelAdmin): selection_note_all = ungettext('%(total_count)s selected', 'All %(total_count)s selected', cl.result_count) - context = dict(self.admin_site.each_context(), + context = dict( + self.admin_site.each_context(), module_name=force_text(opts.verbose_name_plural), selection_note=_('0 of %(cnt)s selected') % {'cnt': len(cl.result_list)}, selection_note_all=selection_note_all % {'total_count': cl.result_count}, @@ -1587,7 +1588,8 @@ class ModelAdmin(BaseModelAdmin): else: title = _("Are you sure?") - context = dict(self.admin_site.each_context(), + context = dict( + self.admin_site.each_context(), title=title, object_name=object_name, object=obj, diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py index e620154312..7b633bef89 100644 --- a/django/contrib/admin/sites.py +++ b/django/contrib/admin/sites.py @@ -398,7 +398,8 @@ class AdminSite(object): for app in app_list: app['models'].sort(key=lambda x: x['name']) - context = dict(self.each_context(), + context = dict( + self.each_context(), title=self.index_title, app_list=app_list, ) diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py index 777bfbac81..0181f665ad 100644 --- a/django/contrib/admin/templatetags/admin_list.py +++ b/django/contrib/admin/templatetags/admin_list.py @@ -95,7 +95,8 @@ def result_headers(cl): """ ordering_field_columns = cl.get_ordering_field_columns() for i, field_name in enumerate(cl.list_display): - text, attr = label_for_field(field_name, cl.model, + text, attr = label_for_field( + field_name, cl.model, model_admin=cl.model_admin, return_attr=True ) diff --git a/django/contrib/admindocs/tests/test_fields.py b/django/contrib/admindocs/tests/test_fields.py index dd465111a1..3f4efedb9c 100644 --- a/django/contrib/admindocs/tests/test_fields.py +++ b/django/contrib/admindocs/tests/test_fields.py @@ -21,7 +21,8 @@ class TestFieldType(unittest.TestCase): pass def test_field_name(self): - self.assertRaises(AttributeError, + self.assertRaises( + AttributeError, views.get_readable_field_data_type, "NotAField" ) diff --git a/django/contrib/admindocs/urls.py b/django/contrib/admindocs/urls.py index 8aa4dcf946..3dc55657df 100644 --- a/django/contrib/admindocs/urls.py +++ b/django/contrib/admindocs/urls.py @@ -4,38 +4,29 @@ from django.contrib.admindocs import views urlpatterns = patterns('', url('^$', views.BaseAdminDocsView.as_view(template_name='admin_doc/index.html'), - name='django-admindocs-docroot' - ), + name='django-admindocs-docroot'), url('^bookmarklets/$', views.BookmarkletsView.as_view(), - name='django-admindocs-bookmarklets' - ), + name='django-admindocs-bookmarklets'), url('^tags/$', views.TemplateTagIndexView.as_view(), - name='django-admindocs-tags' - ), + name='django-admindocs-tags'), url('^filters/$', views.TemplateFilterIndexView.as_view(), - name='django-admindocs-filters' - ), + name='django-admindocs-filters'), url('^views/$', views.ViewIndexView.as_view(), - name='django-admindocs-views-index' - ), + name='django-admindocs-views-index'), url('^views/(?P[^/]+)/$', views.ViewDetailView.as_view(), - name='django-admindocs-views-detail' - ), + name='django-admindocs-views-detail'), url('^models/$', views.ModelIndexView.as_view(), - name='django-admindocs-models-index' - ), + name='django-admindocs-models-index'), url('^models/(?P[^\.]+)\.(?P[^/]+)/$', views.ModelDetailView.as_view(), - name='django-admindocs-models-detail' - ), + name='django-admindocs-models-detail'), url('^templates/(?P