Maybe have a look at generic relations? http://www.djangoproject.com/documentation/models/generic_relations/
You could also use multi-table inheritance rather than abstract classes, then use the parent class Animal as the key in ZooEnclosure. Abstract classes can't exist on their own, which I expect is why you got the NoneType errors. Kip. On Aug 20, 3:57 am, Shay <[EMAIL PROTECTED]> wrote: > Hi, > > I'm rather new to Django, so please bear with me. :P > > I've been trying to figure out how to implement the following in > models: > > class: Animal (abstract class) > ... > > class: Zebra (extends Animal) > ... > > class: Snake (extends Animal) > ... > > class: ZooEnclosure > String enclosureName > Animal inhabitedBy > > So: > - This is a very trivial example > - Zebra and Snake are subclasses of the abstract class Animal > - ZooEnclosure is composed of some sort of Animal where I could > feasibly use a Zebra or a Snake > > Creating a new ZooEnclosure for every animal is not an option because > there're quite a few and could quite possibly result in a hundred > different classes just to change the animal. > > I've looked at the MTI and ABC type documentation (and Google) but I'm > still not clear on how best to implement this in Django Models. > > Oh and when I have attempted to leave Animal abstract, it gives me > NoneType errors. > > I'm not sure what the best way to tackle this problem is, any > suggestions? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---