Backend ended
This commit is contained in:
parent
204623c960
commit
78e18d6dc1
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
from django.views.generic import TemplateView
|
from django.views.generic import TemplateView
|
||||||
|
|
||||||
|
from .models import Reward
|
||||||
|
|
||||||
|
|
||||||
class TombolaView(TemplateView):
|
class TombolaView(TemplateView):
|
||||||
template_name = "tombola.html"
|
template_name = "tombola.html"
|
||||||
|
@ -11,4 +13,13 @@ class TombolaView(TemplateView):
|
||||||
|
|
||||||
context['title'] = "Tombola Saper[list]popette"
|
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
|
return context
|
||||||
|
|
|
@ -7,7 +7,16 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
Old:
|
||||||
|
{% for reward in old_rewards %}
|
||||||
|
{{ reward.name }} (won by {{ previous_reward.rewarded_by.note }}, ticket n°{{ previous_reward.rewarded_by.number }})<br />
|
||||||
|
{% endfor %}
|
||||||
|
Previous: {{ previous_reward.name }} (won by {{ previous_reward.rewarded_by.note }}, ticket n°{{ previous_reward.rewarded_by.number }})<br />
|
||||||
|
Current: {{ current_reward.name }}<br />
|
||||||
|
Next:
|
||||||
|
{% for reward in next_rewards %}
|
||||||
|
{{ reward.name }}<br />
|
||||||
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block extrajavascript %}
|
{% block extrajavascript %}
|
||||||
|
|
Loading…
Reference in New Issue