As someone fairly new to Django, this is confusing me a little bit.
I have a working Django 1.6 app where using a proxy model as a foreign key didn't seem to throw any errors, and the app works.
Testing out Django 1.7a2 however, does not seem to allow this. The Django 1.7 migrations throw an error indicating that the proxy model "cannot be resolved."
For more info on the error I'm getting in 1.7a2, see this post: Possible bug in Django 1.7a2 Migrations?
After some digging around on the net, it seems that allowing proxy models as foreign keys in 1.6 may have been a bug in that some databases will complain, and some will allow it, but you aren't really supposed to be doing it.
Here's one example from South: http://south.aeracode.org/ticket/436 But this SO post seem to indicate it's completely acceptable? Assigning a proxy model instance to foreign key
I can't seem to find any indication in the docs either.
For example:
class Receipt(models.Model):
date = models.DateField()
amount = models.DecimalField(max_digits=7, decimal_places=2)
class ReturnReceipt(Receipt)
class Meta:
proxy = True
def return_status(self):
pass
class ReturnsLedger(modesl.Model):
return_receipt = models.ForeignKey(ReturnReceipt)
Update: Git repo for the example above for someone to try on 1.7 and confirm https://github.com/cgon/djtester
Thanks!