Hi Kip,
Thanks for your help with this. :)
MTI is meant to be Multi-Table Inheritance, sorry. I copied the
reference from other Django related docs. :)
About using that generic_relations example, it's hard to explain
without diagrams but I'll give it a try...
Based on that example:
Though I'm not sure what MTI is (Google suggest "Massage Training
Institute", but that can't be right), what you're trying to do seems
well within Django's capabilities.
Generic relations allow you to create foreign keys to any other
object, so you'd have a Generic Foreign Key in your enclosure,
Hi,
Thanks for the tip, I found Generic Relations and GenericForeignKey
shortly after I posted this and you confirmed I was looking in the
right place. :)
It seemed a better idea to make Animal abstract since I don't want it
to be able to be instantiated on its own. ZooEnclosure should only be
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
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
5 matches
Mail list logo