On 5 déc, 20:30, mack the finger <nbvf...@gmail.com> wrote: > I can't quite wrap my brain around how to do generic relations. I have > a `Receipt` model which is a receipt of a purchase. One of the fields > is `item` which is a foreign key to a product model. I want to be able > to not only have products, but other things that the user can buy. > > What do I need to do here to allow me to link to other types? Just > change the ForeignKey('Product') to generic.GenericForeignKey()? Is > that it?
Actually it's a bit more complicated - but the good news is that it's documented: http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#generic-relations Please read the above doc first, then come back if you have problems ;) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.