Hello, I'm not sure if the subject makes sense but i have two models:

class Profile(models.Model):
    user = models.OneToOneField(User, primary_key=True)
    middle_name = models.CharField(max_length=50, blank=True)
    title = models.CharField(blank=True, max_length=128)
    about = models.TextField(blank=True,help_text="A few sentences
about yourself - capsule biography. No HTML allowed.")
...

class Alumni(models.Model):
    profile = models.OneToOneField(Profile, primary_key=True)
    grad_year = models.IntegerField('Graduation
year',max_length=4,choices=constants.YEARS, null=True)
    third_year = models.BooleanField('Is this student on the 3-year
plan?',default=False)
...

Now I'm working on a search page for people and it's easy enough to do
a query on each model to get results.  But each queryset would be on a
different model so the template would have to deal with a queryset on
Profile, Alumni, or any other extended class that I have.  That seems
kind of messy in the template.

So is there a way I can query on Alumni.objects.filter(**query_params)
but then return the Profile objects related to the Alumni objects
rather than the Alumni objects?  This would allow me to always treat
the results the same in the template regardless of what Profile
extension I am querying.

Thanks for you help,

Milan

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to