I want to do some unusual in Django orm.
I have the model Car
. How can I extend it with additional information, separated by type, storing in another model?
For example, for entry of Car
"My Truck", which type is truck
, i want to extend it with TruckInfo
model.
Another entry "My Bus" i want to extend with BusInfo
model.
In other words, i want to make a floating relationship.
It could be implemented by adding to Car
column with type, and performing SELECT
twice: 1) for selecting cars, 2) for selecting extra info using Car.Type field. But it is terrible solution. I want to make it in a single query.
Maybe you know solution in pure SQL, it will be useful too. Thx.