Skip to content
Snippets Groups Projects
Commit 79c726a0 authored by dcz2's avatar dcz2
Browse files

Restrict all views from the menu to authenticated users

parent bc0b3921
Branches
No related tags found
No related merge requests found
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
<div class="collapse navbar-collapse" id="navbarNav"> <div class="collapse navbar-collapse" id="navbarNav">
{% if request.user.is_authenticated %}
<ul class="navbar-nav mr-auto"> <ul class="navbar-nav mr-auto">
<li class="nav-item" id="nav-entries"> <li class="nav-item" id="nav-entries">
<a class="nav-link text-light" href="{% url 'entries:entries' %}"> <a class="nav-link text-light" href="{% url 'entries:entries' %}">
...@@ -74,6 +75,7 @@ ...@@ -74,6 +75,7 @@
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
{% endif %}
</div> </div>
<span id="import-status" class="navbar-text text-warning mr-3"></span> <span id="import-status" class="navbar-text text-warning mr-3"></span>
{% if request.user.is_authenticated %} {% if request.user.is_authenticated %}
......
from django.contrib.auth.decorators import login_required
from django.shortcuts import render from django.shortcuts import render
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
...@@ -7,6 +8,7 @@ from semantics.models import Frame, FrameOpinion ...@@ -7,6 +8,7 @@ from semantics.models import Frame, FrameOpinion
from entries.polish_strings import POS as POS_names, STATUS, SCHEMA_OPINION, FRAME_OPINION from entries.polish_strings import POS as POS_names, STATUS, SCHEMA_OPINION, FRAME_OPINION
@login_required
def dictionary_statistics(request): def dictionary_statistics(request):
ALL = _('wszystkie') ALL = _('wszystkie')
......
...@@ -51,6 +51,7 @@ MAX_LAST_VISITED = 10 ...@@ -51,6 +51,7 @@ MAX_LAST_VISITED = 10
#def test(request): #def test(request):
# return render(request, 'test.html', {}) # return render(request, 'test.html', {})
@login_required
def entries(request): def entries(request):
# TODO make this automatic by subclassing/configuring session object # TODO make this automatic by subclassing/configuring session object
if 'last_visited' not in request.session: if 'last_visited' not in request.session:
...@@ -349,6 +350,7 @@ def get_scroller_params(POST_data): ...@@ -349,6 +350,7 @@ def get_scroller_params(POST_data):
#from django.db.models import Count #from django.db.models import Count
@ajax_required @ajax_required
@login_required
def get_entries(request): def get_entries(request):
if request.method == 'POST': if request.method == 'POST':
errors_dict = dict() errors_dict = dict()
......
from collections import defaultdict from collections import defaultdict
from django.contrib.auth.decorators import login_required
from django.shortcuts import render from django.shortcuts import render
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from phrase_expansions.models import PhraseExpansionType, PhraseExpansion from phrase_expansions.models import PhraseExpansionType, PhraseExpansion
...@@ -14,6 +14,7 @@ def EXPANSION_OPINION(): ...@@ -14,6 +14,7 @@ def EXPANSION_OPINION():
'cer' : _('pewne'), 'cer' : _('pewne'),
} }
@login_required
def phrase_expansions(request): def phrase_expansions(request):
expansions = defaultdict(list) expansions = defaultdict(list)
expansions = [ expansions = [
......
import json import json
import requests import requests
from django.contrib.auth.decorators import login_required
from django.db import transaction from django.db import transaction
from django.http import JsonResponse, HttpResponse from django.http import JsonResponse, HttpResponse
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
...@@ -206,6 +207,7 @@ def get_unified_frame_json(unifiedFrame, request): ...@@ -206,6 +207,7 @@ def get_unified_frame_json(unifiedFrame, request):
return { 'unified_frame_id': unifiedFrame.id, 'unified_frame': unifiedFrame_dict, 'subentries': subentries, 'frames' : slowal_frames_dict, 'alternations' : alternations, 'realisation_phrases' : realisation_phrases, 'realisation_descriptions' : realisation_descriptions, 'examples' : examples, 'last_visited' : request.session['last_visited'] } return { 'unified_frame_id': unifiedFrame.id, 'unified_frame': unifiedFrame_dict, 'subentries': subentries, 'frames' : slowal_frames_dict, 'alternations' : alternations, 'realisation_phrases' : realisation_phrases, 'realisation_descriptions' : realisation_descriptions, 'examples' : examples, 'last_visited' : request.session['last_visited'] }
@ajax_required @ajax_required
@login_required
def get_unified_frame(request): def get_unified_frame(request):
if request.method == 'POST': if request.method == 'POST':
#TODO (*) #TODO (*)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment