So I've got a Multi-Table parent model, CalendarEvent, and two child
models: Regatta and Meeting.

I've got a calendar view that shows all of the upcoming events like
this:
events = CalendarEvent.objects.all()

But I want to determine what kind of event each of these are (Regatta
or Meeting) from the object's CalendarEvent instance. I could've sworn
I found some good way to do this, but have completely forgotten. I'd
really hate to have to make a field to set the event type in, it seems
counter to the entire idea.

It'd be awesome to be able to do something like:

for event in events:
  if event.child_class == Regatta:
    do stuff

Any ideas for this? I noticed there are methods on each CalendarEvent
'regatta' and 'meeting', worse case I could check each of these for
non-null values and return something, but this seems kludgey.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to