Ticket #4589: add_section_name_option.patch
File add_section_name_option.patch, 1.7 KB (added by , 17 years ago) |
---|
-
django/contrib/admin/options.py
187 187 filter_vertical = () 188 188 filter_horizontal = () 189 189 inlines = [] 190 section_name = '' 190 191 191 192 def __init__(self, model): 192 193 self.model = model -
django/contrib/admin/sites.py
238 238 user = request.user 239 239 for model, model_admin in self._registry.items(): 240 240 app_label = model._meta.app_label 241 section_name = model_admin.section_name or app_label 241 242 has_module_perms = user.has_module_perms(app_label) 242 243 243 244 if has_module_perms: … … 255 256 'admin_url': '%s/%s/' % (app_label, model.__name__.lower()), 256 257 'perms': perms, 257 258 } 258 if app_labelin app_dict:259 app_dict[ app_label]['models'].append(model_dict)259 if section_name in app_dict: 260 app_dict[section_name]['models'].append(model_dict) 260 261 else: 261 app_dict[ app_label] = {262 'name': app_label.title(),262 app_dict[section_name] = { 263 'name': section_name.title(), 263 264 'has_module_perms': has_module_perms, 264 265 'models': [model_dict], 265 266 }