Thursday, October 30, 2014

Re: "Raw query must include the primary key" when inheriting models

Hi Tobias,

Based on your database query, it looks like you are not doing multiple table inheritance, but your models are set up for multiple table inheritance.
https://docs.djangoproject.com/en/dev/topics/db/models/#model-inheritance

Why not just have a status field on your Campaign model? Django expects each (non abstract, non proxy) model to map to a database table.

If you are doing multiple table inheritance, I'm guessing the primary key that django is expecting would be the auto generated campaign_ptr_id, which would live on the campaignext table.

In you are doing multiple table inheritance, why not just do CampaignExt.objects.get(id=campaign_id) ?

Collin

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5b9df009-5c6c-4808-8964-98e871d85fae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment