What I do is I create a superclass that I call Lentity (short for "legal
entity", despite the fact that it could refer to a group of people and is
not
necessary legal) and the two subclasses Person and Organization, with
multi-table inheritance.


Seems silly to name a model as such given that it can easily be
nonrepresentative of the data in the table.

Is it an abstract class? If yes, why not just call it Entity? A legal
status can easily be represented by a field in the model.

If a Person and Organization are treated the same, you can also use just an
Entity table with a field designating the type of Entity, such as 'person'
or 'organization'. Querying all Person and Organization objects would then
constitute only a single query, rather than two queries, one for each model
type. If you add other similar models, you also increase the number of
queries required to pull all of the objects, whereas a field designation
allows you to pull some or all objects regardless of type.

There are a ton of reasons to keep them separate, though, so your design
may still be correct.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciX21jrrdceNoq4VpthKoc%2BH-g2LbOs%3D4xkV5HKxo0cVJA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to