2👍
✅
For the manager_that_queries_both.all
You can use Django Model Utils.
Specifically the Inheritance Manager.
Your foreign keys would refer to the base class. and then you can query them with
Material.objects.select_subclasses()
To do things in your templates depending on the type of the object you could implement the filter described here.
1👍
class SomeObject(Content):
# model_specific_arttributes
is_some_object = True
class SomeOtherObject(Content):
is_some_object = False
Now you can use if
statements in your template to distinguish between the two types of object and use different templates to display them.
Source:stackexchange.com