If I understand your question right there is an example that covers this exact situation that may help at
http://docs.djangoproject.com/en/dev/topics/db/queries/#lookups-that-span-relationships I believe it could come out to something like this: e = Entry.objects.filter(title__exact='foo') blog = e.blog On Jun 15, 2:41 pm, Jason <jnorman...@gmail.com> wrote: > I'm new to django and attempting to leverage the query functionality. > I'm not sure if what I'm attempting requires custom sql or if I"m just > missing something. I'm spending alot of time with the docs but > haven't found guidance for this issue. > > Just using blogs as an easy example, assume the models below... > > class Blog(models.Model): > name = models.CharField(max_length=100, unique=True) > > class Entry(models.Model): > blog = models.ForeignKey(Blog) > title = models.CharField(max_length=100) > > How can I construct a query that returns all blogs where the last > entry has a title of 'foo'? > > Note: Using Django 1.1 beta, and thanks in advance. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---