WS : quand la K-Fêt est ouverte ?
This commit is contained in:
parent
ddf6343826
commit
ce9f717f06
5 changed files with 162 additions and 117 deletions
|
@ -44,10 +44,15 @@ class Home(TemplateView):
|
|||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(TemplateView, self).get_context_data(**kwargs)
|
||||
# Carte
|
||||
articles = Article.objects.all().filter(is_sold=True, hidden=False)
|
||||
context['pressions'] = articles.filter(category__name='Pression')
|
||||
context['articles'] = (articles.exclude(category__name='Pression')
|
||||
.order_by('category'))
|
||||
# La K-Fêt est ouverte ?
|
||||
last_opgroup = OperationGroup.objects.all().order_by('-at').first()
|
||||
context['last_op'] = last_opgroup.at.isoformat()
|
||||
# context['dark'] =
|
||||
return context
|
||||
|
||||
@method_decorator(login_required)
|
||||
|
@ -1108,6 +1113,12 @@ def kpsul_perform_operations(request):
|
|||
'stock': article['stock']
|
||||
})
|
||||
consumers.KPsul.group_send('kfet.kpsul', websocket_data)
|
||||
|
||||
# Websocket last operation
|
||||
websocket_last_op = {}
|
||||
websocket_last_op['last_op'] = operationgroup.at.isoformat()
|
||||
consumers.Home.group_send('kfet.home', websocket_last_op)
|
||||
|
||||
return JsonResponse(data)
|
||||
|
||||
@teamkfet_required
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue