[Answer]-Models inheritance, ForeignKey, get the correct object

1👍

Django won’t automatically downcast models. I found a post by Jeff Elmore on the automatic downcasting of models helpful. In it he mentions django-model-utils and django-polymorphic-models as well as providing his own solution (https://bitbucket.org/Enzondio/django-model-utils/overview).

0👍

This looks very weird. Why would you work with inheritance here? In django every model is a table in your database (or almost every model is, unless it has abstract=True in its meta settings). Your query yields the right results (assuming you have changed the standard objects manager for the modules you are using here), because the only things related to Dashboard is DashoardModule. Rethink the architecture in function of what you want your database to look like.

Check the following links:

Leave a comment