PAOV 4 years ago
parent 43d31a0e3f
commit c12dd36bb2
  1. 1
      choose/templates/vote.html
  2. 7
      choose/views.py
  3. 1
      tea/urls.py

@ -5,6 +5,7 @@
<title>Title</title> <title>Title</title>
</head> </head>
<body> <body>
<button class="btn" onclick="location.replace('/logout');">Выйти</button>
{% if not voted %} {% if not voted %}
<button class="btn" onclick="location.href='/choose'">Проголосовать</button> <button class="btn" onclick="location.href='/choose'">Проголосовать</button>
{% endif %} {% endif %}

@ -1,7 +1,7 @@
import json import json
from collections import OrderedDict from collections import OrderedDict
from django.contrib.auth import authenticate, login from django.contrib.auth import authenticate, login, logout
from django.http import JsonResponse, HttpResponse from django.http import JsonResponse, HttpResponse
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from django.template import loader from django.template import loader
@ -138,3 +138,8 @@ def confirm_cancel_vote(request):
return JsonResponse({'response': 'ok'}) return JsonResponse({'response': 'ok'})
else: else:
return JsonResponse({'response': 'unauthenticated'}) return JsonResponse({'response': 'unauthenticated'})
def logout_view(request):
logout(request)
return redirect(login_view)

@ -6,6 +6,7 @@ from django.conf.urls.static import static
import choose.views import choose.views
urlpatterns = [ urlpatterns = [
path('logout', choose.views.logout_view),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('auth/', include('social_django.urls', namespace='social')), path('auth/', include('social_django.urls', namespace='social')),
path('choose', choose.views.choose, name='choose'), path('choose', choose.views.choose, name='choose'),

Loading…
Cancel
Save