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.