Skip to content

Commit

Permalink
Show only upcoming talks for a series by default. Button to show all. #…
Browse files Browse the repository at this point in the history
  • Loading branch information
ahaith committed Mar 18, 2015
1 parent 7994c3a commit d7c7e97
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions talks/events/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,16 @@ def list_event_groups(request):
def show_event_group(request, event_group_slug):
group = get_object_or_404(EventGroup, slug=event_group_slug)
events = group.events.order_by('start')
show_all = request.GET.get('show_all', False)

if not show_all:
events = events.filter(start__gte=date.today())

context = {
'event_group': group,
'events': events,
'organisers': group.organisers.all(),
'show_all': show_all,
}
return render(request, 'events/event-group.html', context)

Expand Down
7 changes: 7 additions & 0 deletions talks/templates/events/event-group.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ <h3 class="panel-title">{{ event_group.title }}</h3>

</li>
{% endfor %}
<div class="panel-body">
{% if show_all %}
<strong>Showing all talks </strong><a class="btn btn-default navbar-btn pull-right" href="{% url 'show-event-group' event_group.slug %}">Show upcoming talks only</a>
{% else %}
<strong>Only showing upcoming talks </strong><a class="btn btn-default navbar-btn pull-right" href="{% url 'show-event-group' event_group.slug %}?show_all=true">Show all talks in this series</a>
{% endif %}
</div>
</ul>
</div>
{% endblock %}

0 comments on commit d7c7e97

Please sign in to comment.