On Dec 10, 11:04 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Wed, Dec 10, 2008 at 1:51 PM, Mr. T <[EMAIL PROTECTED]> wrote:
>
> > As I am a noob this is very possibly a stupid question....
>
> > Basically I would like to be able to use composition to build some of
> > my models without having separate tables being created.
>
> > class baseClass:
> >   field1
> >   ....
>
> > class foo(models.Model):
> >   my_base = baseClass()
> >   ....
>
> > class bar(models.Model):
> >   my_base = baseClass()
> >   ....
>
> > If possible, I'd like to have the fields of baseClass, such as field1,
> > be columns in my foo and bar table, without having to define any 1 to
> > 1 relationships, or having a baseClass table in my database. Is this
> > possible?
>
> It sounds like you are looking for model inheritance:
>
> http://docs.djangoproject.com/en/dev/topics/db/models/#id4
>
> Karen

Stupid of me to write "myBase". I'm thinking more along the lines of a
few tag fields that might be added to a number of classes. Really not
an "ias" relationship, more like "mixins". Sounds like my options are
inheritance, or duplicating the fields in the various classes. Thanks
for help.
--~--~---------~--~----~------------~-------~--~----~
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