Basically I have a Base class called "Program". I then have more specific program model types that use Program as a base class. For 99% of my needs, I don't care whether or not a Program is one of the specific child types. Of course there's that 1% of the time that I do want to know if it's one of the children.
The problem is that if I have let's say, a SwimProgram model and a CampProgram model using Program as their base, that it's problematic to find out what they are without a bunch of try/except blocks. What I want is something like the following:
program = models.Program.objects.get(id=15)
if program.swimprogram:
## do stuff
elif program.campprogram:
## do stuff
else:
## do other stuff
Of course this throws DoesNotExist exceptions. I could either use try/excepts which are uglier, or I could have Program have a 'type' field that the children set on save. Both are doable, but I'm curious if anyone has any better methods.