For AuditTrail [1] to appear in Django-1.0.x Admin, I need to define a
ModelAdmin subclass as a module attribute. The current version of
AuditTrail still uses the Admin class attribute.
How can I set the result of type('FooAdmin',admin.ModelAdmin) as a
module
attribute that will be located by django.contrib.admin.autodiscover?
from django.contrib import admin
def create_audit_model(cls, **kwargs):
"""Create an audit model for the specific class"""
name = cls.__name__ + 'Audit'
...
if 'show_in_admin' in kwargs and kwargs['show_in_admin']:
# Enable admin integration
# class Admin:
# pass
# attrs['Admin'] = Admin
cls_admin_name = cls.__name__ + 'Admin'
clsAdmin = type(cls_admin_name, (admin.ModelAdmin,),{})
? = clsAdmin
admin.site.register(?, ?)
Thanks.
[1] http://code.djangoproject.com/wiki/AuditTrail
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---