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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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