Model Inheritance Relations

How can one model polymorphism in django 3.0? I.E. I have a class Vehicle then I have the classes Plane, Car, Tank, Bike that all inherit the Vehicle class. Now I want to be able to select all Vehicles (aka getting the objects of all subclasses ( Plane, Car, Tank, Bike )) and set a subclass agnostic foreign key to Vehicles(i.e. a garage having a one to many relationship with vehicles)

Basically I either want django to recognize the Relationships OR I want to mirror all changes to tables of subclasses up to the Vehicle table, so I then have Each Car Bike etc also as a vehicle and find which object to select via a shared identifier.

Django supports 3 methods of model inheritance. You’re looking for multi-table inheritance: https://docs.djangoproject.com/en/3.0/topics/db/models/#model-inheritance

django-polymorphic can make it a bit easier to use in terms of selecting form the base class and gettign the subclasses back: https://django-polymorphic.readthedocs.io/en/latest/