[Django]-Django Multi-Table-Inheritance and Left Outer Joins

0đź‘Ť

If your problem is loading data that you don’t need, you can use the only method to retrieve only the data that you need from the database.

If the problem is somewhat in this shape:

You have one model that always have values in, but it can have a couple of different “profiles” that might or might not be filled in.

I think you are in good shape, I mean, the alternative is to have everything be nullable, which isn’t nice, or to use ForeignKeys, which is gonna result in the same sort of query. The only note that I have is that you should use model inheritance only if it makes sense for the entities that you are working with, otherwise you can use a OneToOne field (this is only conceptually because inheritance uses a OneToOne field under the hood)

👤Augusto Hack

Leave a comment