mirror of
https://github.com/django/django.git
synced 2025-10-27 07:36:08 +00:00
newforms-admin: A model's 'class Admin' is now dynamically/magically converted to be a subclass of django.contrib.admin.options.ModelAdmin, and the admin site now uses that class rather than the separate AdminOptions class (for list_display only). This means means 'class Admin' can override any functionality of ModelAdmin, such as has_add_permission(), etc.
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@4328 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -32,6 +32,9 @@ def unquote(s):
|
||||
|
||||
class ModelAdmin(object):
|
||||
"Encapsulates all admin options and functionality for a given model."
|
||||
|
||||
list_display = ('__str__',)
|
||||
|
||||
def __init__(self, model):
|
||||
self.model = model
|
||||
self.opts = model._meta
|
||||
@@ -266,7 +269,7 @@ class ModelAdmin(object):
|
||||
if not self.has_change_permission(request, None):
|
||||
raise PermissionDenied
|
||||
try:
|
||||
cl = ChangeList(request, self.model)
|
||||
cl = ChangeList(request, self.model, self.list_display)
|
||||
except IncorrectLookupParameters:
|
||||
# Wacky lookup parameters were given, so redirect to the main
|
||||
# changelist page, without parameters, and pass an 'invalid=1'
|
||||
|
||||
Reference in New Issue
Block a user