question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't use proxy models with django-reversion

See original GitHub issue

Hello!

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:closed
  • Created 12 years ago
  • Comments:47 (32 by maintainers)

github_iconTop GitHub Comments

2reactions
etianencommented, Oct 31, 2017

I’ve just made the docs more explicit for this use case. Thanks for the suggestion!

1reaction
AgDudecommented, Dec 11, 2013

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found