Ok, you are asking for a list of events that have occurences on or
after today's date. Then with each event instance you are asking for
ALL occurence instances (event.occurrence_set.all). ALL means EVERY
occurence associated with that event object. You haven't done
anything to filter out occurrences based on date in that step.
-Brian
On Jul 1, 9:51 am, Brandon Taylor <[EMAIL PROTECTED]> wrote:
> Hi everyone,
>
> I have Events and Occurrences of an Event. Occurrence contains a
> foreign_key for the Event.
> In my template, I need to display the Event and Occurrences as such:
>
> Event Title One
> June 1, 2008 [times]
> July 23, 2008 [times]
>
> Event Title Two
> August 25, 2008 [times]
> September 1, 2008 [times]
>
> But, I only want to display dates that are greater than, or equal to
> today. In my view, I am selecting Events as such:
>
> events_list =
> events.filter(occurrence__date__gte=datetime.datetime.today())
>
> Here's my template code:
> <ul>
> {% for event in events_list %}
> <li>{{ event.title }}
> {% for occurrence in event.occurrence_set.all %}
> <ul>
> <li>
> {{ occurrence.date }}
> </li>
> </ul>
> {% endfor %}
> </li>
> {% endfor %}
> </ul>
>
> Which is showing ALL of the occurrences, not just the ones with a date
> greater than today. Given the sample data set above, it shouldn't
> display the event for June. Can someone please help me out with this?
> I'd really appreciate some advice.
>
> TIA,
> Brandon
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---