Backend ended
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user