Ticket #8572: autodiscover_improvement_r8596.2.diff

File autodiscover_improvement_r8596.2.diff, 3.7 KB (added by Manuel Saelices, 16 years ago)

I've missing to modify django.contrib.sites.admin

  • django/contrib/redirects/admin.py

     
    88    search_fields = ('old_path', 'new_path')
    99    radio_fields = {'site': admin.VERTICAL}
    1010
    11 admin.site.register(Redirect, RedirectAdmin)
    12  Sin fin-de-línea al final del archivo
     11def register(site):
     12    site.register(Redirect, RedirectAdmin)
     13 Sin fin-de-línea al final del archivo
  • django/contrib/comments/admin.py

     
    2121    date_hierarchy = 'submit_date'
    2222    search_fields = ('comment', 'user__username', 'user_name', 'user_email', 'user_url', 'ip_address')
    2323
    24 admin.site.register(Comment, CommentsAdmin)
     24def register(site):
     25    site.register(Comment, CommentsAdmin)
  • django/contrib/sites/admin.py

     
    66    list_display = ('domain', 'name')
    77    search_fields = ('domain', 'name')
    88
    9 admin.site.register(Site, SiteAdmin)
    10  Sin fin-de-línea al final del archivo
     9def register(site):
     10    site.register(Site, SiteAdmin)
     11 Sin fin-de-línea al final del archivo
  • django/contrib/admin/__init__.py

     
    22from django.contrib.admin.options import StackedInline, TabularInline
    33from django.contrib.admin.sites import AdminSite, site
    44
    5 def autodiscover():
     5def autodiscover(admin_site=None):
    66    """
    77    Auto-discover INSTALLED_APPS admin.py modules and fail silently when
    88    not present. This forces an import on them to register any admin bits they
     
    1111    import imp
    1212    from django.conf import settings
    1313
     14    if admin_site is None:
     15        admin_site = site
     16
    1417    for app in settings.INSTALLED_APPS:
    1518        # For each app, we need to look for an admin.py inside that app's
    1619        # package. We can't use os.path here -- recall that modules may be
     
    3740
    3841        # Step 3: import the app's admin file. If this has errors we want them
    3942        # 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

     
    107107        }, context_instance=RequestContext(request))
    108108
    109109
    110 admin.site.register(Group, GroupAdmin)
    111 admin.site.register(User, UserAdmin)
     110def register(site):
     111    site.register(Group, GroupAdmin)
     112    site.register(User, UserAdmin)
    112113
  • django/contrib/flatpages/admin.py

     
    2525    list_filter = ('sites', 'enable_comments', 'registration_required')
    2626    search_fields = ('url', 'title')
    2727
    28 admin.site.register(FlatPage, FlatPageAdmin)
     28def register(site):
     29    site.register(FlatPage, FlatPageAdmin)
Back to Top