Model Inheritance

1 view
Skip to first unread message

jurian

unread,
Mar 30, 2008, 4:27:15 PM3/30/08
to Django users
How would I go about implementing a model that only exists to be
inherited from and not used on it's own?

Example:

class Animal(models.Model):
name = models.CharField()

class Dog(Animal):
x = models.CharField()

class Cat(Animal):
y = models.CharField()


In the example I want to create and manipulate dog and cat objects,
but I will never need to use animal objects, so the animal table
doesn't need to be created at all.

David Marquis

unread,
Mar 30, 2008, 11:01:19 PM3/30/08
to django...@googlegroups.com
I think that Django does not support model inheritance (yet).
The dev team seems to have thought about it :
http://code.djangoproject.com/wiki/ModelInheritance

You might want to ask Google for "django model inheritance" for all
the information you need.

--
David

jurian

unread,
Mar 31, 2008, 2:01:31 AM3/31/08
to Django users
It's working on the latest development release. Does that mean I
should move this discussion to the developers group?

James Bennett

unread,
Mar 31, 2008, 2:09:44 AM3/31/08
to django...@googlegroups.com
On Mon, Mar 31, 2008 at 1:01 AM, jurian <juria...@gmail.com> wrote:
> It's working on the latest development release.

No, it's working in a branch.

> Does that mean I
> should move this discussion to the developers group?

No, it means that if you're interested you should check out the
branch, which has full documentation of the feature, though you should
keep in mind that it's still under development.

--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

flo...@gmail.com

unread,
Mar 31, 2008, 2:10:51 AM3/31/08
to Django users
> No, it's working in a branch.

By the way, the specific branch that this should be working under is
queryset-refactor.
Reply all
Reply to author
Forward
0 new messages