Thanks Malcolm!
Python code:
def main(request):
feed_titles = Feed.objects.all()
feed_list = FeedItem.objects.all().order_by('feed_id')
#i tried a for loop here appending feed_list to a list...but
template wouldn't see list as object...?
t = loader.get_template('aggregator/aggregator.html')
c = Context({
'feed_titles': feed_titles,
'feed_list': feed_list,
})
return HttpResponse(t.render(c))
I'm unsure how to pass an object of objects (I tried lists...?) to my
template?
Thanks!
On Apr 29, 2:29 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Sun, 2007-04-29 at 07:29 +0000, [EMAIL PROTECTED] wrote:
> > Hi everyone,
>
> > Django/python newbie but I'm enjoying it so far!
>
> > Quick question:
>
> > How would I write this
>
> > SELECT * FROM aggregator_feeditems WHERE feed_id = 1 ORDER BY feed_id
> > LIMIT 0,7
>
> > in either a view or template where the feed_id value would be updated
> > in a loop?
>
> Depends a lot on what the fields in your model are called. But, very
> roughly, it will be something like
>
> FeedItems.objects.filter(feed_id=1).order_by('feed_id')[:8]
>
> Regards,
> malcolm
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---