Ticket #17498: admin.sites.2.patch

File admin.sites.2.patch, 1.2 KB (added by kace, 12 years ago)

improved patch for ModelAdmin option "no_index"

  • django/contrib/admin/sites.py

     
    354354            app_label = model._meta.app_label
    355355            has_module_perms = user.has_module_perms(app_label)
    356356
    357             if has_module_perms:
     357            if not model_admin.no_index and has_module_perms :
    358358                perms = model_admin.get_model_perms(request)
    359359
    360360                # Check whether user has any perm for this module.
     
    415415        app_dict = {}
    416416        for model, model_admin in self._registry.items():
    417417            if app_label == model._meta.app_label:
    418                 if has_module_perms:
     418                if not model_admin.no_index and has_module_perms :
    419419                    perms = model_admin.get_model_perms(request)
    420420
    421421                    # Check whether user has any perm for this module.
  • django/contrib/admin/options.py

     
    6969    prepopulated_fields = {}
    7070    formfield_overrides = {}
    7171    readonly_fields = ()
     72    no_index = False
    7273
    7374    def __init__(self):
    7475        overrides = FORMFIELD_FOR_DBFIELD_DEFAULTS.copy()
Back to Top