Yes, it works! Thanks so much, that is the perfect solution! Inheritance in Django in my opinion should do much more, but in this case it actually does the job!
On Oct 27, 2:31 pm, pixelcowboy <pixelcowbo...@gmail.com> wrote: > The second solution would be great, but is the relationship inherited? > I didnt think that was possible. Will try it out, first solution is > also an option. Thanks for your help. > > On Oct 27, 1:35 pm, Marc Aymerich <glicer...@gmail.com> wrote: > > > On Tue, Oct 26, 2010 at 6:21 PM, pixelcowboy <pixelcowbo...@gmail.com>wrote: > > > > I have a question regarding the best way to conceptualize a model. I > > > have a tasks model, which I want to hook to a few different other > > > models: The model Project, the model Company and a few other undefined > > > models. The problem is that I want a particular instance of the task > > > to be pluggable to one and only one of those models, which I dont know > > > how I would achieve using 2 or more separate foreign keys. The only > > > idea I have is to use generic relationships, and unique them. Any > > > ideas? > > > Maybe something like this? > > > class Base(models.Model): > > pass > > > class Project(Base): > > pass > > > class Company(Base): > > pass > > > class Task(models.Model): > > base = models.ForeignKey(Base) > > > -- > > Marc -- 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.