On Wed, Mar 5, 2014 at 10:52 AM, Tom Evans <[email protected]> wrote:
> Your derived classes are models, and they should be models. What they
> shouldn't be is have different tables for each model type, there
> should be one table that all instances are stored in to, as the data
> for each Calculation instance, regardless of type, is the same.
>
> This is a common idiom in ORMs, and is called Single Table Inheritance:
>
> http://www.martinfowler.com/eaaCatalog/singleTableInheritance.html
>
> Django doesn't support STI, but that doesn't really matter, you can
> get the same behaviour by using composition rather than inheritance,
> something like this:

that sounds very similar to django's proxy models:

https://docs.djangoproject.com/en/1.6/topics/db/models/#proxy-models

but I agree that this kind of problems are typically better solved byt
composition rather than inheritance.

-- 
Javier

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFkDaoSi0ETcKpTfRMNe1ziAXWhV%3DTgvdoeVzgW6jDaXxxN9EA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to