forked from DGNum/gestioCOF
kfet.open
kfet.open app - Base data (raw_open, last_update...) is stored and shared through cache system. - 2 websockets groups: one for team users, one for other users. - UI is initialized and kept up-to-date with WS. - raw_open and force_close can be updated with standard HTTP requests. At this time, there isn't any restriction on raw_open view. Common sense tell us to change this behavior. Misc - Clean channels routing. - 'PermConsumerMixin': user who sent the message is available as argument in connection_groups method, which returns groups to which the user should be appended on websocket connection (and discarded on disconnection). - New kfet.utils module: should be used for mixins, whatever is useful and not concerns the kfet app. - Clean JS dependencies.
This commit is contained in:
parent
2381af92e3
commit
b8110c11a4
37 changed files with 852 additions and 404 deletions
27
kfet/open/views.py
Normal file
27
kfet/open/views.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
from django.contrib.auth.decorators import permission_required
|
||||
from django.http import HttpResponse
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.views.decorators.http import require_POST
|
||||
|
||||
from .open import kfet_open
|
||||
|
||||
|
||||
TRUE_STR = ['1', 'True', 'true']
|
||||
|
||||
|
||||
@csrf_exempt
|
||||
@require_POST
|
||||
def raw_open(request):
|
||||
raw_open = request.POST.get('raw_open') in TRUE_STR
|
||||
kfet_open.raw_open = raw_open
|
||||
kfet_open.send_ws()
|
||||
return HttpResponse()
|
||||
|
||||
|
||||
@permission_required('kfet.can_force_close', raise_exception=True)
|
||||
@require_POST
|
||||
def force_close(request):
|
||||
force_close = request.POST.get('force_close') in TRUE_STR
|
||||
kfet_open.force_close = force_close
|
||||
kfet_open.send_ws()
|
||||
return HttpResponse()
|
Loading…
Add table
Add a link
Reference in a new issue