Can't use proxy models with django-reversion
See original GitHub issueHello!
Currently exception is thrown when one tries to register a proxy model. Advice is to register a parent class.
But django emits post_save
signal with a proxy model class as a sender (not a parent class) so _post_save_receiver
is omitted and thus a version/revision is lost.
Why exactly we may want to restrict proxy-model registration?
It works for me if I register both parent and proxy-child (assuming that I’ve commented out raise RegistrationError(..)
).
Issue Analytics
- State:
- Created 12 years ago
- Comments:47 (32 by maintainers)
Top Results From Across the Web
Django-reversion and proxy models - Stack Overflow
I'm the author of django-reversion! This is a known issue with proxy models, due to a bug in Django's content types framework that...
Read more >django-reversion API - Read the Docs
If you're using the Admin integration, model registration is automatic. ... If False , proxy models will be saved under their own content...
Read more >11154 (Inconsistency with permissions for proxy models)
The inconsistency lies in that permissions are created using the ContentType of the proxy model's parent class. However, permissions are checked using the ......
Read more >Re: [Django] #11154: Inconsistency with permissions for proxy models
The auth framework could then use that flag to create the missings permissions for proxy model. Plus it would allow polymorphic solutions
Read more >How to use Django's Proxy Models
A proxy model doesn't get its own database table. Instead it operates on the original table. class MyModel(models.Model): ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve just made the docs more explicit for this use case. Thanks for the suggestion!
I have implemented limited support for proxy models in this fork https://github.com/AgDude/django-reversion
Tests are still needed. This is working for my specific use case. I have not tested the admin at all.
If a proxy model is registered, that post_save signal will be attached. Versions are saved with the content type of the concrete model, so history must be retrieved using the concrete model. Both the concrete parent model and the proxy model must be registered with reversion. The proxy model can define a different set of “follows” relationships than the concrete parent model.