Awesome... that did it. Here's my function as a reference:

def oldentries(start, number):
        x = Entry.objects.filter(pub_date__lt=start)[:number]
        return { 'object_list':x }

and then I can call {{ oldentries object.pub_date 5 }} to get the
previous five entries.

Perfect, thanks :)

Björn

On Mar 13, 5:12 pm, "theju" <[EMAIL PROTECTED]> wrote:
> Hi Björn,
> You can use the filter method to get the required output. The field
> lookup types will also be very helpful.
>
> So you could probably use
> Entry.objects.filter(your_datefield_lte = '2007-03-13') [:5]
>
> What the above piece of code does is it shows the last five entries
> from the Entry object whose date field <= 2006-01-01.
>
> You can replace the date with the year, month and day parameters
> obtained from the generic view request object.
>
> Check out for various field lookups and field lookup types 
> athttp://www.djangoproject.com/documentation/db_api/
>
> Hope you find it useful.
> -Thejaswi Puthraya


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to