From: Guillaume Pellerin Date: Wed, 2 Jul 2025 14:12:27 +0000 (+0200) Subject: rename tags X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=0ac98661b12d72f0d5eb722de545631e91c527af;p=pdfannotator.git rename tags --- diff --git a/pdfannotator/templates/pdfannotator/pdfannotator.html b/pdfannotator/templates/pdfannotator/pdfannotator.html index 1dac172..c1e8b6c 100644 --- a/pdfannotator/templates/pdfannotator/pdfannotator.html +++ b/pdfannotator/templates/pdfannotator/pdfannotator.html @@ -1,5 +1,5 @@ {% load static %} -{% load pdfannotator %} +{% load pdfannotator_tags %}
{% if not readonly %} diff --git a/pdfannotator/templatetags/pdfannotator.py b/pdfannotator/templatetags/pdfannotator.py deleted file mode 100644 index bf40662..0000000 --- a/pdfannotator/templatetags/pdfannotator.py +++ /dev/null @@ -1,18 +0,0 @@ -from django import template - -register = template.Library() - -@register.inclusion_tag('pdfannotator/pdfannotator.html', takes_context=True) -def pdfannotator(context, url, uuid): - request = context['request'] - user = request.user - readonly = True - if user.professor.all() or user.is_superuser or user.quotas.all(): - readonly = False - return { - 'url':url, - 'uuid': uuid, - 'username':user.username, - 'is_admin':user.is_superuser, - 'readonly':readonly - } diff --git a/pdfannotator/templatetags/pdfannotator_tags.py b/pdfannotator/templatetags/pdfannotator_tags.py new file mode 100644 index 0000000..bf40662 --- /dev/null +++ b/pdfannotator/templatetags/pdfannotator_tags.py @@ -0,0 +1,18 @@ +from django import template + +register = template.Library() + +@register.inclusion_tag('pdfannotator/pdfannotator.html', takes_context=True) +def pdfannotator(context, url, uuid): + request = context['request'] + user = request.user + readonly = True + if user.professor.all() or user.is_superuser or user.quotas.all(): + readonly = False + return { + 'url':url, + 'uuid': uuid, + 'username':user.username, + 'is_admin':user.is_superuser, + 'readonly':readonly + }