Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Upgrading breaks _autoregister() on proxy model #94

dannyadair opened this Issue · 2 comments

2 participants

dannyadair Dave Hall

Just upgraded from 1.3.3, getting an exception on startup:

 File "/home/danny/.virtualenvs/myproject/lib/python2.7/site-packages/reversion/", line 85, in __init__
   self._autoregister(self.model, inline_fields)

 File "/home/danny/.virtualenvs/myproject/lib/python2.7/site-packages/reversion/", line 58, in _autoregister

AttributeError: 'NoneType' object has no attribute 'name'

It seems this commit
removed the "if field:" check for proxy fields - can this just be put back in?


Dave Hall


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

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.

dannyadair dannyadair closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.