diff --git a/apps/tbde/views.py b/apps/tbde/views.py
index 3864f07..a81ad72 100644
--- a/apps/tbde/views.py
+++ b/apps/tbde/views.py
@@ -2,6 +2,8 @@
from django.views.generic import TemplateView
+from .models import Reward
+
class TombolaView(TemplateView):
template_name = "tombola.html"
@@ -11,4 +13,13 @@ class TombolaView(TemplateView):
context['title'] = "Tombola Saper[list]popette"
+ next_rewards = Reward.objects.filter(rewarded_by__isnull=True).order_by('order')
+ old_reward = Reward.objects.filter(rewarded_by__isnull=False).order_by('order')
+ context['old_rewards'] = old_reward.all()
+ if old_reward.exists():
+ context['previous_reward'] = old_reward.last()
+ context['next_rewards'] = next_rewards.all()
+ if next_rewards.exists():
+ context['current_reward'] = next_rewards.first()
+
return context
diff --git a/templates/tombola.html b/templates/tombola.html
index 389ed3e..f73bca6 100644
--- a/templates/tombola.html
+++ b/templates/tombola.html
@@ -7,7 +7,16 @@
{% endblock %}
{% block content %}
-
+ Old:
+ {% for reward in old_rewards %}
+ {{ reward.name }} (won by {{ previous_reward.rewarded_by.note }}, ticket n°{{ previous_reward.rewarded_by.number }})
+ {% endfor %}
+ Previous: {{ previous_reward.name }} (won by {{ previous_reward.rewarded_by.note }}, ticket n°{{ previous_reward.rewarded_by.number }})
+ Current: {{ current_reward.name }}
+ Next:
+ {% for reward in next_rewards %}
+ {{ reward.name }}
+ {% endfor %}
{% endblock %}
{% block extrajavascript %}