django-polymorphic
django-polymorphic copied to clipboard
Integration with django-reversion error
I am using django-reversion to support version control of model objects, and I followed the instructions from Third-party applications support in the doc. Below is the example from the doc:
class ModelAChildAdmin(PolymorphicChildModelAdmin, VersionAdmin):
base_model = ModelA # optional, explicitly set here.
base_form = ...
base_fieldsets = (
...
)
class ModelBAdmin(ModelAChildAdmin, VersionAdmin):
# define custom features here
class ModelCAdmin(ModelBAdmin):
# define custom features here
class ModelAParentAdmin(VersionAdmin, PolymorphicParentModelAdmin):
base_model = ModelA # optional, explicitly set here.
child_models = (
(ModelB, ModelBAdmin), <---
(ModelC, ModelCAdmin), <---
)
revisions.register(ModelB, follow=['modela_ptr'])
revisions.register(ModelC, follow=['modelb_ptr'])
admin.site.register(ModelA, ModelAParentAdmin)
An error occured
Exception has occurred: TypeError
issubclass() arg 1 must be a class
I guess it is due to the child_models attribute in ModelAParentAdmin class is assigned with a list of tuples, which actually requires a list of model classes.
If I fix that error by changing the child_models to child_models = ( ModelB, ModelC, ), then ModelB and ModelC are not registered in the admin site.
So my question is how can I integrate django-reversion with django-polymorphic. Any working examples are appreciated!
Thank you