Ticket #6327: has_module_permission.diff
File has_module_permission.diff, 1.2 KB (added by , 17 years ago) |
---|
-
django/contrib/admin/options.py
270 270 271 271 return forms.Media(js=['%s%s' % (settings.ADMIN_MEDIA_PREFIX, url) for url in js]) 272 272 media = property(_media) 273 274 def has_module_permission(self, request): 275 "Returns True if the given request has permission the the module." 276 opts = self.opts 277 return request.user.has_module_perms(opts.app_label) 273 278 274 279 def has_add_permission(self, request): 275 280 "Returns True if the given request has permission to add an object." -
django/contrib/admin/sites.py
261 261 user = request.user 262 262 for model, model_admin in self._registry.items(): 263 263 app_label = model._meta.app_label 264 has_module_perms = user.has_module_perms(app_label)264 has_module_perms = model_admin.has_module_permission(request) 265 265 266 266 if has_module_perms: 267 267 perms = {