Ticket #8572: autodiscover_improvement_r8596.2.diff
File autodiscover_improvement_r8596.2.diff, 3.7 KB (added by , 16 years ago) |
---|
-
django/contrib/redirects/admin.py
8 8 search_fields = ('old_path', 'new_path') 9 9 radio_fields = {'site': admin.VERTICAL} 10 10 11 admin.site.register(Redirect, RedirectAdmin) 12 Sin fin-de-línea al final del archivo 11 def register(site): 12 site.register(Redirect, RedirectAdmin) 13 Sin fin-de-línea al final del archivo -
django/contrib/comments/admin.py
21 21 date_hierarchy = 'submit_date' 22 22 search_fields = ('comment', 'user__username', 'user_name', 'user_email', 'user_url', 'ip_address') 23 23 24 admin.site.register(Comment, CommentsAdmin) 24 def register(site): 25 site.register(Comment, CommentsAdmin) -
django/contrib/sites/admin.py
6 6 list_display = ('domain', 'name') 7 7 search_fields = ('domain', 'name') 8 8 9 admin.site.register(Site, SiteAdmin) 10 Sin fin-de-línea al final del archivo 9 def register(site): 10 site.register(Site, SiteAdmin) 11 Sin fin-de-línea al final del archivo -
django/contrib/admin/__init__.py
2 2 from django.contrib.admin.options import StackedInline, TabularInline 3 3 from django.contrib.admin.sites import AdminSite, site 4 4 5 def autodiscover( ):5 def autodiscover(admin_site=None): 6 6 """ 7 7 Auto-discover INSTALLED_APPS admin.py modules and fail silently when 8 8 not present. This forces an import on them to register any admin bits they … … 11 11 import imp 12 12 from django.conf import settings 13 13 14 if admin_site is None: 15 admin_site = site 16 14 17 for app in settings.INSTALLED_APPS: 15 18 # For each app, we need to look for an admin.py inside that app's 16 19 # package. We can't use os.path here -- recall that modules may be … … 37 40 38 41 # Step 3: import the app's admin file. If this has errors we want them 39 42 # to bubble up. 40 __import__("%s.admin" % app) 43 mod = __import__('%s.admin' % app, {}, {}, app.split('.')) 44 45 # Step 4: look for register function and call it, passing admin site 46 # as parameter 47 register_func = getattr(mod, 'register', None) 48 if register_func is not None and callable(register_func): 49 register_func(admin_site) -
django/contrib/auth/admin.py
107 107 }, context_instance=RequestContext(request)) 108 108 109 109 110 admin.site.register(Group, GroupAdmin) 111 admin.site.register(User, UserAdmin) 110 def register(site): 111 site.register(Group, GroupAdmin) 112 site.register(User, UserAdmin) 112 113 -
django/contrib/flatpages/admin.py
25 25 list_filter = ('sites', 'enable_comments', 'registration_required') 26 26 search_fields = ('url', 'title') 27 27 28 admin.site.register(FlatPage, FlatPageAdmin) 28 def register(site): 29 site.register(FlatPage, FlatPageAdmin)