diff --git a/common/templates/base.html b/common/templates/base.html index 770ca005330baeaff2b69313cab091cfcf21e247..f39de094022127559c84ab1497c5551df13fc62a 100644 --- a/common/templates/base.html +++ b/common/templates/base.html @@ -49,6 +49,7 @@ <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarNav"> + {% if request.user.is_authenticated %} <ul class="navbar-nav mr-auto"> <li class="nav-item" id="nav-entries"> <a class="nav-link text-light" href="{% url 'entries:entries' %}"> @@ -74,6 +75,7 @@ </li> {% endif %} </ul> + {% endif %} </div> <span id="import-status" class="navbar-text text-warning mr-3"></span> {% if request.user.is_authenticated %} diff --git a/dictionary_statistics/views.py b/dictionary_statistics/views.py index e91161ab6ba7b252ae9aad5505c0dde5cb54fbb8..c681d40d2780f4d54d3ea4d93799b69557b42dde 100644 --- a/dictionary_statistics/views.py +++ b/dictionary_statistics/views.py @@ -1,3 +1,4 @@ +from django.contrib.auth.decorators import login_required from django.shortcuts import render from django.utils.translation import gettext as _ @@ -7,6 +8,7 @@ from semantics.models import Frame, FrameOpinion from entries.polish_strings import POS as POS_names, STATUS, SCHEMA_OPINION, FRAME_OPINION +@login_required def dictionary_statistics(request): ALL = _('wszystkie') diff --git a/entries/views.py b/entries/views.py index 8eb87d97ab4c5bd0fd3270ed780cd27734e1c393..2a2d2f5875a863e1a799ad69651fa1345644aa47 100644 --- a/entries/views.py +++ b/entries/views.py @@ -51,6 +51,7 @@ MAX_LAST_VISITED = 10 #def test(request): # return render(request, 'test.html', {}) +@login_required def entries(request): # TODO make this automatic by subclassing/configuring session object if 'last_visited' not in request.session: @@ -349,6 +350,7 @@ def get_scroller_params(POST_data): #from django.db.models import Count @ajax_required +@login_required def get_entries(request): if request.method == 'POST': errors_dict = dict() diff --git a/phrase_expansions/views.py b/phrase_expansions/views.py index 58162d367760d4c7f9722760db4cc38a4881682a..4821f6485c9048b516345fb7a88987936f96e9a1 100644 --- a/phrase_expansions/views.py +++ b/phrase_expansions/views.py @@ -1,7 +1,7 @@ from collections import defaultdict +from django.contrib.auth.decorators import login_required from django.shortcuts import render - from django.utils.translation import gettext as _ from phrase_expansions.models import PhraseExpansionType, PhraseExpansion @@ -13,7 +13,8 @@ def EXPANSION_OPINION(): 'unc' : _('wÄ…tpliwe'), 'cer' : _('pewne'), } - + +@login_required def phrase_expansions(request): expansions = defaultdict(list) expansions = [ diff --git a/unifier/views.py b/unifier/views.py index beb6b499b58177486b27f896cbe2591ebd5d4b42..119cac2c73c8c73f689153465e8d274c0a421355 100644 --- a/unifier/views.py +++ b/unifier/views.py @@ -1,5 +1,6 @@ import json import requests +from django.contrib.auth.decorators import login_required from django.db import transaction from django.http import JsonResponse, HttpResponse from django.shortcuts import get_object_or_404 @@ -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'] } @ajax_required +@login_required def get_unified_frame(request): if request.method == 'POST': #TODO (*)