properly redirect on logout from protected pages
tabs = []
user = context['user']
tabs = []
user = context['user']
- if user.is_authenticated():
- tabs.append(Tab('my', _('My page'), reverse("catalogue_user")))
+ tabs.append(Tab('my', _('My page'), reverse("catalogue_user")))
tabs.append(Tab('activity', _('Activity'), reverse("catalogue_activity")))
tabs.append(Tab('all', _('All'), reverse("catalogue_document_list")))
tabs.append(Tab('users', _('Users'), reverse("catalogue_users")))
tabs.append(Tab('activity', _('Activity'), reverse("catalogue_activity")))
tabs.append(Tab('all', _('All'), reverse("catalogue_document_list")))
tabs.append(Tab('users', _('Users'), reverse("catalogue_users")))
- tabs.append(Tab('create', _('Add'), reverse("catalogue_create_missing")))
- tabs.append(Tab('upload', _('Upload'), reverse("catalogue_upload")))
+
+ if user.has_perm('catalogue.add_book'):
+ tabs.append(Tab('create', _('Add'), reverse("catalogue_create_missing")))
+ tabs.append(Tab('upload', _('Upload'), reverse("catalogue_upload")))
if user.is_staff:
tabs.append(Tab('admin', _('Admin'), reverse("admin:index")))
if user.is_staff:
tabs.append(Tab('admin', _('Admin'), reverse("admin:index")))
return render(request, 'catalogue/my_page.html', {
'last_books': sorted(request.session.get("wiki_last_books", {}).items(),
key=lambda x: x[1]['time'], reverse=True),
return render(request, 'catalogue/my_page.html', {
'last_books': sorted(request.session.get("wiki_last_books", {}).items(),
key=lambda x: x[1]['time'], reverse=True),
return direct_to_template(request, "catalogue/document_create_missing.html", extra_context={
"slug": slug,
"form": form,
return direct_to_template(request, "catalogue/document_create_missing.html", extra_context={
"slug": slug,
"form": form,
"ok_list": ok_list,
"skipped_list": skipped_list,
"error_list": error_list,
"ok_list": ok_list,
"skipped_list": skipped_list,
"error_list": error_list,
})
else:
form = forms.DocumentsUploadForm()
return direct_to_template(request, "catalogue/document_upload.html", extra_context={
"form": form,
})
else:
form = forms.DocumentsUploadForm()
return direct_to_template(request, "catalogue/document_upload.html", extra_context={
"form": form,
return direct_to_template(request, "catalogue/book_append_to.html", extra_context={
"book": book,
"form": form,
return direct_to_template(request, "catalogue/book_append_to.html", extra_context={
"book": book,
"form": form,
{% if user.is_authenticated %}
<span class="user_name">{{ user.username }}</span> |
{% if user.is_authenticated %}
<span class="user_name">{{ user.username }}</span> |
-<a href='{% url logout %}'>{% trans "Log Out" %}</a>
+<a href='{% url logout %}{% if logout_to %}?next={{ logout_to }}{% endif %}'>{% trans "Log Out" %}</a>
{% else %}
{% url login as login_url %}
{% ifnotequal login_url request.path %}
{% else %}
{% url login as login_url %}
{% ifnotequal login_url request.path %}