On Fri, May 15, 2009 at 2:21 PM, Michael Strickland <moriog...@gmail.com> wrote:
>
> Hi all,
>
> I've recently encountered a problem that arose with revision 10756.
> Say you have the following models:
>
> class Person(models.Model):
>    name = models.CharField(max_length=20)
>
> class Student(Person):
>    grad_year = models.IntegerField()
>
> class Picture(models.Model):
>    image = models.ImageField(upload_to='images')
>    owner = models.ForeignKey(Student)
>
> In other words, Pictures belong to Students through a FK, and Students
> use MTI to inherit from Persons.
>
> This worked fine, up until 10756 (http://code.djangoproject.com/
> changeset/10756). Now, it throws a DoesNotExist exception (at  /usr/
> lib/python2.5/site-packages/django/db/models/fields/related.py in
> __get__, line 243) when Picture is included in the inlines for
> Student.
>
> I've been able to make it work by having the foreignkey point to
> Person instead of Student, but that's not exactly ideal with my real
> models. Since the specifics of that revision are a bit over my head,
> can anyone tell me if this was an intended side effect of it, and if
> so, why foreignkeys to inherited models would no longer be supported?

I can't see immediately wrong with your example, so I'm guessing this
is an unintended consequence. I'll take a look at this; it would be
most helpful if you could open a ticket with your example code.

Yours
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to