On Fri, 2007-03-30 at 20:34 +0000, drackett wrote:
> If I have multiple items that I want to use a common model, is there a
> way to do this? currently I have:
> 
> class Link(models.Model):
>       author = models.ForeignKey(User)
>       link = URLField()
>       description = TextField(blank=True)
>       entry_date = models.DateTimeField(default=datetime.now)
> 
> class Picture(models.Model):
>       author = models.ForeignKey(User)
>       link = URLField()
>       description = TextField(blank=True)
>       entry_date = models.DateTimeField(default=datetime.now)
> 
> class Movie(models.Model):
>       author = models.ForeignKey(User)
>       link = URLField()
>       description = TextField(blank=True)
>       entry_date = models.DateTimeField(default=datetime.now)
> 
> and what I would like is the fields above to be common. I will be
> adding unique fields to each of these items as well, but would like to
> be able, in the future, to add or remove one of these common fields
> easily.

"Real soon now" (before 1.0), model inheritance will work. Until then,
put the common stuff into it's own model and use a OneToOne field from
each of the derived models to point to the common stuff.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to