Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Upgrading breaks _autoregister() on proxy model #94
Just upgraded from 1.3.3, getting an exception on startup:
It seems this commit
The autoregister thing for proxy models was taken out because, as it turned out, it was somewhat broken. If it was working for you, then excellent! But in a lot of cases it wasn't.
The issue is that django's a bit confused about proxy models. The actual proxy model has it's own ContentType entry in the database, but ContentType.objects.get_for_model(Model) returns the content type of the parent model. I lodged a bug in the Django issue tracker a long time ago about this:
While this inconsistent handling of content types and proxy models exists, django-reversion is going to give inconsistent behaviour in it's version handling. If you can think of a consistent solution to this issue, I'd love to hear it.
Wow - didn't realise the issue behind this. I just separated User admin into customers and staff - http://www.mahner.org/posts/separating-staff-and-user-accounts-in-djangos-admin/ - and went about daily business. Then reversion broke upon upgrade. Now I understand the issue better, thank you.
I just had a look at this and posted a suggestion on how to fix it in the Django ticket: https://code.djangoproject.com/ticket/11154#comment:23
django.contrib.contenttypes.models.ContentTypeManager._get_opts() needs to respect/preserve a proxy model's app_label, not just traverse up to the non-proxy and use all its meta. Closing this ticket.