On 8/16/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I've got an app for user events, using the generic list view to display
> them. So far , so good. But I don't want to display them if the date is
> past. So, how would I filter those out. Here's the template code, so
> you can sorta see what I'm getting at:

If you're using a generic view, then this sort of filtering should be
done in your urls.py file -- you should already be passing in a
parameter named queryset to the view, so rather than saying, for
instance,

queryset=MyModel.objects.all()

you would add a filter, to make it more like this:

queryset=MyModel.objects.filter(date__gte=datetime.now())

to pass only those objects whose "date" field represents a date after
the present. Of course, the details will vary, depending on the name
of your model and its fields, and the exact structure of your urls.py
file.

-- 
Regards,
Ian Clelland
<[EMAIL PROTECTED]>

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

Reply via email to