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.

Reply via email to