Django model inheritance: create sub-instance of existing instance (downcast)?

I found this answer by asking on django-user mailing list:

https://groups.google.com/d/msg/django-users/02t83cuEbeg/JnPkriW-omQJ

This isn't part of the public API but you could rely on how Django loads fixture internally.

parent = Restaurant.objects.get(name__iexact="Bob's Place").parent
bar = Bar(parent=parent, happy_hour=True)
bar.save_base(raw=True)

Keep in mind that this could break with any new version of Django.


This should work:

extended_user = ExtendedUser(user_ptr_id=auth_user.pk)
extended_user.__dict__.update(auth_user.__dict__)
extended_user.save()

Here you're basically just copying over the values from the auth_user version into the extended_user one, and re-saving it. Not very elegant, but it works.