I'm hoping to be able to create an object using a base model but have that object actually be created as a proxy class depending on the object's field(s).
So for example, for the following models:
class Animal(models.Model):
species = models.CharField()
class Cat(Animal):
class Meta:
proxy = True
class Dog(Animal):
class Meta:
proxy = True
How can I set it up so that
cat = Animal.objects.create(species="cat")
dog = Animal.objects.create(species="dog")
Animal.objects.all() # Returns queryset of [cat, dog]
Cat.objects.all() # Returns queryset of [cat]
Dog.objects.all() # Returns queryset of [dog]
Edit: I would be interested in both types of solutions:
a) The object is created as a Animal first then converted to the proxy class afterwards
b) The object is created directly as the proxy class
(Solution type A is probably most relevant to my use case unfortunately)