diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py index a2a7df945a4b..318c393c090a 100644 --- a/django/contrib/admin/helpers.py +++ b/django/contrib/admin/helpers.py @@ -42,7 +42,8 @@ def __init__(self, form, fieldsets, prepopulated_fields, readonly_fields=None, m 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 51e8a1b2e6bb..4c5adaf0f8b5 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -1520,7 +1520,8 @@ def changelist_view(self, request, extra_context=None): 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 @@ def delete_view(self, request, object_id, extra_context=None): 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 e620154312f5..7b633bef89c8 100644 --- a/django/contrib/admin/sites.py +++ b/django/contrib/admin/sites.py @@ -398,7 +398,8 @@ def index(self, request, extra_context=None): 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 777bfbac81e3..0181f665ad2c 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 dd465111a177..3f4efedb9c22 100644 --- a/django/contrib/admindocs/tests/test_fields.py +++ b/django/contrib/admindocs/tests/test_fields.py @@ -21,7 +21,8 @@ def setUp(self): 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 8aa4dcf94616..3dc55657df61 100644 --- a/django/contrib/admindocs/urls.py +++ b/django/contrib/admindocs/urls.py @@ -4,38 +4,29 @@ 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