[damned-lies] Generalized usage of the static template tag
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Generalized usage of the static template tag
- Date: Sat, 17 Apr 2021 09:47:37 +0000 (UTC)
commit 9e9f0a614ad71963b3ac45cd93c5dad607f8a3fc
Author: Claude Paroz <claude 2xlibre net>
Date: Sat Apr 17 10:23:02 2021 +0200
Generalized usage of the static template tag
damnedlies/settings.py | 4 +++
people/templatetags/people.py | 3 ++-
stats/models.py | 3 ++-
templates/404.html | 1 -
templates/500.html | 1 -
templates/about.html | 1 -
templates/admin/base_site.html | 1 -
templates/admin/delete_release_confirmation.html | 1 -
templates/base.html | 27 ++++++++++---------
templates/base_modal.html | 2 --
templates/branch_detail.html | 2 --
templates/error.html | 3 ---
templates/feeds/actions_description.html | 1 -
templates/help/reduced_po.html | 1 -
templates/help/vertimus_workflow.html | 3 +--
templates/index.html | 1 -
templates/languages/language_all_modules.html | 3 +--
templates/languages/language_list.html | 5 ++--
templates/languages/language_release.html | 3 +--
templates/languages/language_release_stats.html | 4 +--
templates/languages/language_release_summary.html | 4 +--
templates/login.html | 2 --
templates/login/login_popup_form.html | 2 --
templates/login/login_usermenu.html | 2 +-
templates/module_detail.html | 19 +++++++-------
templates/module_edit_branches.html | 1 -
templates/module_images.html | 4 +--
templates/module_list.html | 1 -
templates/people/person_base.html | 2 +-
templates/people/person_detail.html | 6 ++---
templates/people/person_detail_change_form.html | 1 -
templates/people/person_list.html | 2 +-
templates/people/person_overview.html | 2 +-
templates/people/person_password_change_form.html | 1 -
templates/people/person_team_join_form.html | 1 -
templates/people/person_team_membership.html | 1 -
.../registration/password_reset_complete.html | 1 -
templates/registration/password_reset_confirm.html | 1 -
templates/registration/password_reset_done.html | 1 -
templates/registration/password_reset_form.html | 1 -
templates/registration/register.html | 1 -
templates/registration/register_success.html | 2 --
templates/release_compare.html | 3 +--
templates/release_detail.html | 4 +--
templates/release_list.html | 1 -
templates/stats_show.html | 12 ++++-----
templates/teams/team_base.html | 3 +--
templates/teams/team_detail.html | 10 ++++----
templates/teams/team_edit.html | 4 +--
templates/teams/team_list.html | 2 +-
templates/vertimus/activity_summary.html | 3 +--
templates/vertimus/quality-check.html | 1 -
templates/vertimus/vertimus_detail.html | 30 +++++++++++-----------
templates/vertimus/vertimus_diff.html | 3 +--
vertimus/templatetags/vertimus.py | 5 ++--
55 files changed, 85 insertions(+), 124 deletions(-)
---
diff --git a/damnedlies/settings.py b/damnedlies/settings.py
index 83098201..e6aeb0a6 100644
--- a/damnedlies/settings.py
+++ b/damnedlies/settings.py
@@ -111,6 +111,10 @@ TEMPLATES = [
'django.template.loaders.app_directories.Loader',
]),
],
+ 'builtins': [
+ 'django.templatetags.i18n',
+ 'django.templatetags.static',
+ ],
},
},
]
diff --git a/people/templatetags/people.py b/people/templatetags/people.py
index 3acf4616..a67054d8 100644
--- a/people/templatetags/people.py
+++ b/people/templatetags/people.py
@@ -2,6 +2,7 @@ import hashlib
from django import template
from django.conf import settings
+from django.templatetags.static import static
from django.utils.html import format_html, format_html_join
from django.utils.http import urlencode
from django.utils.translation import gettext as _
@@ -25,7 +26,7 @@ def people_list(lst):
@register.filter
def people_image(person):
- nobody = settings.STATIC_URL + "img/nobody.png"
+ nobody = static("img/nobody.png")
if person and person.avatar_service:
digest = hashlib.md5(person.email.lower().encode("utf-8")).hexdigest()
url = AVATAR_SERVICES[person.avatar_service].format(
diff --git a/stats/models.py b/stats/models.py
index 631c6611..92d01811 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -15,6 +15,7 @@ from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.management import call_command
from django.core.validators import RegexValidator
+from django.templatetags.static import static
from django.urls import reverse
from django.utils.encoding import force_str
from django.utils.functional import cached_property
@@ -1923,7 +1924,7 @@ class Information(models.Model):
return self.statistics.module_name < other.statistics.module_name
def get_icon(self):
- return "%simg/%s.png" % (settings.STATIC_URL, self.type.split("-")[0])
+ return static("img/%s.png" % (self.type.split("-")[0]))
def get_description(self):
text = self.description
diff --git a/templates/404.html b/templates/404.html
index 3200d458..f700dab3 100644
--- a/templates/404.html
+++ b/templates/404.html
@@ -1,5 +1,4 @@
{% extends "base.html" %}
-{% load i18n %}
{% block title %} {% trans "Error: page not found" %} {% endblock %}
diff --git a/templates/500.html b/templates/500.html
index 568a5391..7daba614 100644
--- a/templates/500.html
+++ b/templates/500.html
@@ -1,5 +1,4 @@
{% extends "base.html" %}
-{% load i18n %}
{% block title %} {% trans "Error: server error (500)" %} {% endblock %}
diff --git a/templates/about.html b/templates/about.html
index bdbb0bd4..0633ea9e 100644
--- a/templates/about.html
+++ b/templates/about.html
@@ -1,5 +1,4 @@
{% extends "base.html" %}
-{% load i18n %}
{% block title %} {% trans "About" %} {% endblock %}
diff --git a/templates/admin/base_site.html b/templates/admin/base_site.html
index 1e4f5757..a24c2adb 100644
--- a/templates/admin/base_site.html
+++ b/templates/admin/base_site.html
@@ -1,5 +1,4 @@
{% extends "admin/base.html" %}
-{% load i18n %}
{% block title %}{{ title }} | {% trans 'Damned Lies site admin' %}{% endblock %}
diff --git a/templates/admin/delete_release_confirmation.html
b/templates/admin/delete_release_confirmation.html
index 6c8f19f3..02aa37e0 100644
--- a/templates/admin/delete_release_confirmation.html
+++ b/templates/admin/delete_release_confirmation.html
@@ -1,5 +1,4 @@
{% extends "admin/base_site.html" %}
-{% load i18n %}
{% block breadcrumbs %}
<div class="breadcrumbs">
diff --git a/templates/base.html b/templates/base.html
index 2ee3bf70..9eb975cf 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -1,22 +1,21 @@
-{% load i18n people %}
-{% load stats_extras %}
+{% load people stats_extras %}
<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE }}">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
- <title>{% block title %}page title{% endblock %}</title>
- <link rel="icon" type="image/png" href="{{ STATIC_URL }}img/favicon.ico">
+ <title>{% block title %}{% trans "Damned Lies about GNOME" %}{% endblock %}</title>
+ <link rel="icon" type="image/png" href="{% static 'img/favicon.ico' %}">
<link rel="stylesheet" type="text/css" href="https://static.gnome.org/css/deneb.min.css"
crossorigin="anonymous">
- <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/template.css">
+ <link rel="stylesheet" type="text/css" href="{% static 'css/template.css' %}">
{% if LANGUAGE_BIDI %}
- <link rel="stylesheet" href="{{ STATIC_URL }}css/rtl.css">
+ <link rel="stylesheet" href="{% static 'css/rtl.css' %}">
{% endif %}
- <script src="{{ STATIC_URL }}js/jquery.min.js"></script>
- <script src="{{ STATIC_URL }}js/js.cookie-2.2.1.min.js"></script>
- <script src="{{ STATIC_URL }}js/main.js"></script>
- <script src="{{ STATIC_URL }}js/modal.js"></script>
- <script src="{{ STATIC_URL }}js/login.js"></script>
+ <script src="{% static 'js/jquery.min.js' %}"></script>
+ <script src="{% static 'js/js.cookie-2.2.1.min.js' %}"></script>
+ <script src="{% static 'js/main.js' %}"></script>
+ <script src="{% static 'js/modal.js' %}"></script>
+ <script src="{% static 'js/login.js' %}"></script>
<script>
$(document).ready(function () {
@@ -40,13 +39,13 @@
<span class="icon-bar middle-bar"></span>
<span class="icon-bar bottom-bar"></span>
</button>
- <a class="gnome-navbar-brand" title="{% trans "Back to Damned Lies home page" %}"
href="/"><img src="{{ STATIC_URL }}img/gnome-logo.svg" alt="GNOME - Damned Lies" /></a>
+ <a class="gnome-navbar-brand" title="{% trans "Back to Damned Lies home page" %}"
href="/"><img src="{% static 'img/gnome-logo.svg' %}" alt="GNOME - Damned Lies"></a>
<ul class="nav navbar-nav icons visible-xs">
<li class="dropdown pull-right">
{% if user.is_authenticated %}
<a data-target="#userDropdownMenu" class="dropdown-toggle avatar"
data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ user.person|people_image
}}</a>
{% else %}
- <a href="#userDropdownMenu" class="dropdown-toggle" data-toggle="dropdown"
role="button" aria-haspopup="true" aria-expanded="false"><img src="{{ STATIC_URL }}img/avatar-default.svg"
alt="GNOME - Damned Lies" /></a>
+ <a href="#userDropdownMenu" class="dropdown-toggle" data-toggle="dropdown"
role="button" aria-haspopup="true" aria-expanded="false"><img src="{% static 'img/avatar-default.svg' %}"
alt="GNOME - Damned Lies"></a>
{% endif %}
</li>
</ul>
diff --git a/templates/base_modal.html b/templates/base_modal.html
index 991fab86..1cb1c516 100644
--- a/templates/base_modal.html
+++ b/templates/base_modal.html
@@ -1,5 +1,3 @@
-{% load i18n %}
-
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 class="modal-title">{% block content-title %}{% endblock %}</h3>
diff --git a/templates/branch_detail.html b/templates/branch_detail.html
index a9a6a1ac..2904cefb 100644
--- a/templates/branch_detail.html
+++ b/templates/branch_detail.html
@@ -1,5 +1,3 @@
-{% load i18n %}
-
{% if branch.has_string_frozen %}
<p>{% trans "This branch is currently string-frozen." %}</p>
{% endif %}
diff --git a/templates/error.html b/templates/error.html
index 398bdab7..61e810e9 100644
--- a/templates/error.html
+++ b/templates/error.html
@@ -1,7 +1,4 @@
{% extends "base.html" %}
-{% load i18n %}
-
-{% block title %} {% trans "Damned Lies about GNOME" %} {% endblock %}
{% block content %}
<div class="mainpage">
diff --git a/templates/feeds/actions_description.html b/templates/feeds/actions_description.html
index b24ba050..d58e0de5 100644
--- a/templates/feeds/actions_description.html
+++ b/templates/feeds/actions_description.html
@@ -1,4 +1,3 @@
-{% load i18n %}
</p>
{% if obj.comment %}
{{ obj.comment }}
diff --git a/templates/help/reduced_po.html b/templates/help/reduced_po.html
index e19360be..d03f3bcd 100644
--- a/templates/help/reduced_po.html
+++ b/templates/help/reduced_po.html
@@ -1,5 +1,4 @@
{% extends base %}
-{% load i18n %}
{% block title %}{% trans "Help" %}{% endblock %}
diff --git a/templates/help/vertimus_workflow.html b/templates/help/vertimus_workflow.html
index 42ee2254..779e9b38 100644
--- a/templates/help/vertimus_workflow.html
+++ b/templates/help/vertimus_workflow.html
@@ -1,5 +1,4 @@
{% extends base %}
-{% load i18n %}
{% block title %}{% trans "Help" %}{% endblock %}
@@ -7,5 +6,5 @@
{% block content %}
<p>{% trans "The figure below describes the various states and actions available during the translation
process of a module." %}</p>
-<img class="img-responsive" src="{{ STATIC_URL }}img/workflow-translation.png">
+<img class="img-responsive" src="{% static 'img/workflow-translation.png' %}">
{% endblock %}
diff --git a/templates/index.html b/templates/index.html
index 6a655781..a0c53665 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -1,5 +1,4 @@
{% extends "base.html" %}
-{% load i18n %}
{% block title %} {% trans "Damned Lies about GNOME" %} {% endblock %}
diff --git a/templates/languages/language_all_modules.html b/templates/languages/language_all_modules.html
index 055ae515..4e9d73a9 100644
--- a/templates/languages/language_all_modules.html
+++ b/templates/languages/language_all_modules.html
@@ -1,10 +1,9 @@
{% extends "base.html" %}
-{% load i18n %}
{% block title %} {% trans "All modules" %} - {{ language.get_name }}{% endblock %}
{% block extrahead %}
-<script src="{{ STATIC_URL }}js/jquery.tablesorter.min.js"></script>
+<script src="{% static 'js/jquery.tablesorter.min.js' %}"></script>
<script>
$(document).ready(function()
{
diff --git a/templates/languages/language_list.html b/templates/languages/language_list.html
index bf234e01..7d7cac07 100644
--- a/templates/languages/language_list.html
+++ b/templates/languages/language_list.html
@@ -1,5 +1,4 @@
{% extends "base.html" %}
-{% load i18n %}
{% block title %}{% trans "GNOME Languages" %}{% endblock %}
@@ -22,8 +21,8 @@
<li>
<a href="{% url 'lang_feed' lang.locale %}">
<img width="10" height="10"
- src="{{ STATIC_URL }}img/feed-icon-10x10.png"
- alt="{% blocktrans %}RSS feed for {{ lang.get_name }}{% endblocktrans %}"/>
+ src="{% static 'img/feed-icon-10x10.png' %}"
+ alt="{% blocktrans %}RSS feed for {{ lang.get_name }}{% endblocktrans %}">
</a>
<a href="{{ lang.get_team_url }}">{{ lang.get_name }}</a>
</li>
diff --git a/templates/languages/language_release.html b/templates/languages/language_release.html
index fe94f03b..844ab748 100644
--- a/templates/languages/language_release.html
+++ b/templates/languages/language_release.html
@@ -1,9 +1,8 @@
{% extends "base.html" %}
-{% load i18n %}
{% block title %} {% trans release.description %} - {{ language_name }}{% endblock %}
{% block extrahead %}
-<script src="{{ STATIC_URL }}js/jquery.tablesorter.min.js"></script>
+<script src="{% static 'js/jquery.tablesorter.min.js' %}"></script>
<script>
$(document).ready(function()
{
diff --git a/templates/languages/language_release_stats.html b/templates/languages/language_release_stats.html
index 28c3e26e..27a57f5b 100644
--- a/templates/languages/language_release_stats.html
+++ b/templates/languages/language_release_stats.html
@@ -1,6 +1,6 @@
{# parent template has to define variable modstats #}
-{% load i18n stats_extras %}
+{% load stats_extras %}
<div id="hide-show">
<a href="#" id="hide-completed-modules">{% trans "Hide completed modules" %}</a>
@@ -64,7 +64,7 @@
<img src="{{ err.get_icon }}" title="{{ err.get_description|striptags }}" alt="{{ err.type }}" />
{% endfor %}
{% if stat.get_type == "mallard" %}
- <img style="margin-left: 1px;" src="{{ STATIC_URL }}img/mallard.png" width="18" title="{% trans
"This document is written in Mallard documentation format" %}" alt="mallard icon"/>
+ <img style="margin-left: 1px;" src="{% static 'img/mallard.png' %}" width="18" title="{% trans
"This document is written in Mallard documentation format" %}" alt="mallard icon">
{% endif %}
</td>
<td><span class="branch">{{ branch }}</span></td>
diff --git a/templates/languages/language_release_summary.html
b/templates/languages/language_release_summary.html
index 09a8aca9..76cb4d34 100644
--- a/templates/languages/language_release_summary.html
+++ b/templates/languages/language_release_summary.html
@@ -1,4 +1,4 @@
-{% load i18n stats_extras %}
+{% load stats_extras %}
{% comment %}
Following variables should be set:
lang : current language
@@ -12,7 +12,7 @@ Following variables should be set:
<th>{% trans "User Interface" %}</th>
<th>{% trans "Graph" %}</th>
<th>{% trans "User Interface (red.)" %}
- <a href="{% url 'help' 'reduced_po' 1 %}" data-target="#modal-container" role="button"
data-toggle="modal"><img src="{{ STATIC_URL }}img/help.png" alt="help icon"></a>
+ <a href="{% url 'help' 'reduced_po' 1 %}" data-target="#modal-container" role="button"
data-toggle="modal"><img src="{% static 'img/help.png' %}" alt="help icon"></a>
</th>
<th>{% trans "Documentation" %}</th>
<th>{% trans "Graph" %}</th>
diff --git a/templates/login.html b/templates/login.html
index eefe86d8..8c7c94cb 100644
--- a/templates/login.html
+++ b/templates/login.html
@@ -1,7 +1,5 @@
{% extends "base.html" %}
-{% load i18n %}
-{% block title %} {% trans "Damned Lies about GNOME" %} {% endblock %}
{% block content %}
<div class="mainpage">
<div class="col-sm-8 col-md-6 col-centered">
diff --git a/templates/login/login_popup_form.html b/templates/login/login_popup_form.html
index d90e2267..b9ea6336 100644
--- a/templates/login/login_popup_form.html
+++ b/templates/login/login_popup_form.html
@@ -1,5 +1,3 @@
-{% load i18n %}
-
<div class="row">
<div class="col-sm-12">
<form action="{% url 'login' %}" method="post" class="form">
diff --git a/templates/login/login_usermenu.html b/templates/login/login_usermenu.html
index 2c555bcd..9e04fa38 100644
--- a/templates/login/login_usermenu.html
+++ b/templates/login/login_usermenu.html
@@ -1,4 +1,4 @@
-{% load i18n people %}
+{% load people %}
{% if user.is_authenticated %}
<div class="row">
diff --git a/templates/module_detail.html b/templates/module_detail.html
index 6c4bc22d..fc53f64e 100644
--- a/templates/module_detail.html
+++ b/templates/module_detail.html
@@ -1,5 +1,4 @@
{% extends "base.html" %}
-{% load i18n %}
{% block title %}
{% blocktrans with module.get_description as name %}Module Statistics: {{ name }}{% endblocktrans %}
@@ -14,7 +13,7 @@ $(document).ready(function() {
is_visible = branch_div.is(':visible');
if (is_visible) {
branch_div.slideUp();
- $(this).children('img').attr("src", "{{ STATIC_URL }}img/closed.png");
+ $(this).children('img').attr("src", "{% static 'img/closed.png' %}");
} else {
if (branch_div.attr("class") == "empty") {
// Load the branch stats dynamically
@@ -25,7 +24,7 @@ $(document).ready(function() {
} else {
branch_div.slideDown();
}
- $(this).children('img').attr("src", "{{ STATIC_URL }}img/open.png");
+ $(this).children('img').attr("src", "{% static 'img/open.png' %}");
}
});
$(".refresh").click(function(event) {
@@ -50,7 +49,7 @@ $(document).ready(function() {
<p>{{ module.get_comment|safe }}</p>
{% else %}
{% if not module.has_standard_vcs %}
- <p><em><img src="{{ STATIC_URL }}img/warn.png" alt="Warning logo" /> {{ non_standard_repo_msg }}</em></p>
+ <p><em><img src="{% static 'img/warn.png' %}" alt="Warning logo"> {{ non_standard_repo_msg }}</em></p>
{% endif %}
{% endif %}
@@ -88,13 +87,13 @@ $(document).ready(function() {
<p>
<strong>{% trans "Branches:" %}</strong>
{% if can_edit_branches %}
- <a href="{% url 'module_edit_branches' module.name %}"><img src="{{ STATIC_URL }}img/edit.png"
alt="Edit" /></a>
+ <a href="{% url 'module_edit_branches' module.name %}"><img src="{% static 'img/edit.png' %}"
alt="Edit"></a>
{% endif %}
{% for branch in branches %}
{% if forloop.counter != 1 %} - {% endif %}
<a href="#{{ branch.name }}">{{ branch.name }}</a>
{% if branch.warnings %}
- <img src="{{ STATIC_URL }}img/warn.png" title="{{ branch.warnings }}" />
+ <img src="{% static 'img/warn.png' %}" title="{{ branch.warnings }}">
{% endif %}
{% endfor %}
</p>
@@ -104,17 +103,17 @@ $(document).ready(function() {
<hr>
<h2><a href="." class="branch" id="{{ branch.name|slugify }}">
{% if forloop.counter < 3 %}
- <img src="{{ STATIC_URL }}img/open.png" /></a>
+ <img src="{% static 'img/open.png' %}"></a>
{% else %}
- <img src="{{ STATIC_URL }}img/closed.png" /></a>
+ <img src="{% static 'img/closed.png' %}"></a>
{% endif %}
<a name="{{ branch.name }}"></a>{{ branch.name }}
{% if branch.get_vcs_web_url %}
- <a href="{{ branch.get_vcs_web_url }}" title="{% trans 'Browse Repository' %}"><img src="{{ STATIC_URL
}}img/repository-icon.png" /></a>
+ <a href="{{ branch.get_vcs_web_url }}" title="{% trans 'Browse Repository' %}"><img src="{% static
'img/repository-icon.png' %}"></a>
{% endif %}
{% if can_refresh %}
<a href="{% url 'branch_refresh' branch.pk %}" title="{% trans 'Refresh branch statistics' %}"
class="refresh">
- <img src="{{ STATIC_URL }}img/refresh.png"></a>
+ <img src="{% static 'img/refresh.png' %}"></a>
{% endif %}
</h2>
{% if forloop.counter < 3 %}
diff --git a/templates/module_edit_branches.html b/templates/module_edit_branches.html
index 287cc12b..639c3d22 100644
--- a/templates/module_edit_branches.html
+++ b/templates/module_edit_branches.html
@@ -1,5 +1,4 @@
{% extends "base.html" %}
-{% load i18n %}
{% block title %} Module Edition (branches) {% endblock %}
diff --git a/templates/module_images.html b/templates/module_images.html
index 99e318dc..875915fa 100644
--- a/templates/module_images.html
+++ b/templates/module_images.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-{% load i18n stats_extras %}
+{% load stats_extras %}
{% block title %} {% blocktrans with module.description as name %}Module Doc Figure Status: {{ name }}{%
endblocktrans %} {% endblock %}
@@ -44,7 +44,7 @@
{% endif %}
{% else %}
<em>{% trans "Not translated" %}</em><br/>
- <img src="{{ STATIC_URL }}img/emptyimg.png">
+ <img src="{% static 'img/emptyimg.png' %}">
{% endif %}
{% endif %}
</td>
diff --git a/templates/module_list.html b/templates/module_list.html
index 5f525570..b08ad7fa 100644
--- a/templates/module_list.html
+++ b/templates/module_list.html
@@ -1,5 +1,4 @@
{% extends "base.html" %}
-{% load i18n %}
{% block title %}{% trans "GNOME Modules" %}{% endblock %}
diff --git a/templates/people/person_base.html b/templates/people/person_base.html
index 06c0cd17..4b4fce73 100644
--- a/templates/people/person_base.html
+++ b/templates/people/person_base.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-{% load i18n stats_extras %}
+{% load stats_extras %}
{% block title %}{% trans "GNOME Contributor" %}{% endblock %}
diff --git a/templates/people/person_detail.html b/templates/people/person_detail.html
index db61da59..0f226a5d 100644
--- a/templates/people/person_detail.html
+++ b/templates/people/person_detail.html
@@ -1,10 +1,8 @@
{% extends "people/person_base.html" %}
-{% load i18n %}
-{% load humanize %}
-{% load stats_extras %}
+{% load humanize stats_extras %}
{% block extrahead %}
-<script src="{{ STATIC_URL }}js/jquery.tablesorter.min.js"></script>
+<script src="{% static 'js/jquery.tablesorter.min.js' %}"></script>
<script>
$(document).ready(function()
{
diff --git a/templates/people/person_detail_change_form.html b/templates/people/person_detail_change_form.html
index e1bbfe48..fe568356 100644
--- a/templates/people/person_detail_change_form.html
+++ b/templates/people/person_detail_change_form.html
@@ -1,5 +1,4 @@
{% extends "people/person_base.html" %}
-{% load i18n %}
{% load stats_extras %}
{% block subcontent %}
diff --git a/templates/people/person_list.html b/templates/people/person_list.html
index bbef7335..a1c86452 100644
--- a/templates/people/person_list.html
+++ b/templates/people/person_list.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-{% load i18n people %}
+{% load people %}
{% block title %}{% trans "GNOME Contributors" %}{% endblock %}
diff --git a/templates/people/person_overview.html b/templates/people/person_overview.html
index a6b5c15d..788f3c88 100644
--- a/templates/people/person_overview.html
+++ b/templates/people/person_overview.html
@@ -1,7 +1,7 @@
{# Variables $person and $printroles must be defined prior to calling this template #}
{# This template is included in person.html, team.html and language-release.html #}
-{% load i18n static people %}
+{% load people %}
<div class="person_detail col-sm-9">
<div class="image">{{ person|people_image }}</div>
diff --git a/templates/people/person_password_change_form.html
b/templates/people/person_password_change_form.html
index 9cadad0e..527bde60 100644
--- a/templates/people/person_password_change_form.html
+++ b/templates/people/person_password_change_form.html
@@ -1,5 +1,4 @@
{% extends "people/person_base.html" %}
-{% load i18n %}
{% block subcontent %}
diff --git a/templates/people/person_team_join_form.html b/templates/people/person_team_join_form.html
index 84e6e4b9..e18b7006 100644
--- a/templates/people/person_team_join_form.html
+++ b/templates/people/person_team_join_form.html
@@ -1,5 +1,4 @@
{% extends "people/person_base.html" %}
-{% load i18n %}
{% block subcontent %}
diff --git a/templates/people/person_team_membership.html b/templates/people/person_team_membership.html
index 3dc8578c..b9c82fa0 100644
--- a/templates/people/person_team_membership.html
+++ b/templates/people/person_team_membership.html
@@ -1,4 +1,3 @@
-{% load i18n %}
{% load stats_extras %}
{% if person.role_set.all %}
diff --git a/templates/registration/password_reset_complete.html
b/templates/registration/password_reset_complete.html
index 850f5a70..067667f3 100644
--- a/templates/registration/password_reset_complete.html
+++ b/templates/registration/password_reset_complete.html
@@ -1,5 +1,4 @@
{% extends "base.html" %}
-{% load i18n %}
{% block title %}{% trans 'Password reset complete' %}{% endblock %}
diff --git a/templates/registration/password_reset_confirm.html
b/templates/registration/password_reset_confirm.html
index 3d9482f2..d607a471 100644
--- a/templates/registration/password_reset_confirm.html
+++ b/templates/registration/password_reset_confirm.html
@@ -1,5 +1,4 @@
{% extends "base.html" %}
-{% load i18n %}
{% block title %}{% trans 'Password reset' %}{% endblock %}
diff --git a/templates/registration/password_reset_done.html b/templates/registration/password_reset_done.html
index 01a3ec7a..3d6f74b5 100644
--- a/templates/registration/password_reset_done.html
+++ b/templates/registration/password_reset_done.html
@@ -1,5 +1,4 @@
{% extends "base.html" %}
-{% load i18n %}
{% block title %}{% trans 'Password reset successful' %}{% endblock %}
diff --git a/templates/registration/password_reset_form.html b/templates/registration/password_reset_form.html
index cc1f14ec..98f0325e 100644
--- a/templates/registration/password_reset_form.html
+++ b/templates/registration/password_reset_form.html
@@ -1,5 +1,4 @@
{% extends "base.html" %}
-{% load i18n %}
{% block title %}{% trans "Password reset" %}{% endblock %}
diff --git a/templates/registration/register.html b/templates/registration/register.html
index f41d106d..9286f937 100644
--- a/templates/registration/register.html
+++ b/templates/registration/register.html
@@ -1,5 +1,4 @@
{% extends "base.html" %}
-{% load i18n %}
{% block title %} {% trans "Damned Lies about GNOME" %} {% endblock %}
{% block content %}
diff --git a/templates/registration/register_success.html b/templates/registration/register_success.html
index 80624471..0fcef146 100644
--- a/templates/registration/register_success.html
+++ b/templates/registration/register_success.html
@@ -1,7 +1,5 @@
{% extends "base.html" %}
-{% load i18n %}
-{% block title %} {% trans "Damned Lies about GNOME" %} {% endblock %}
{% block content %}
<div class="mainpage">
diff --git a/templates/release_compare.html b/templates/release_compare.html
index 168410d5..ef5c65ad 100644
--- a/templates/release_compare.html
+++ b/templates/release_compare.html
@@ -1,10 +1,9 @@
{% extends "base.html" %}
-{% load i18n %}
{% load stats_extras %}
{% block title %} {% trans "Releases Comparison" %} {% endblock %}
{% block extrahead %}
-<script src="{{ STATIC_URL }}js/jquery.tablesorter.min.js"></script>
+<script src="{% static 'js/jquery.tablesorter.min.js' %}"></script>
<script>
$(document).ready(function()
{
diff --git a/templates/release_detail.html b/templates/release_detail.html
index 1d3fb0e6..82f3ffe8 100644
--- a/templates/release_detail.html
+++ b/templates/release_detail.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-{% load i18n stats_extras %}
+{% load stats_extras %}
{% block title %} {% trans release.description %} {% endblock %}
@@ -22,7 +22,7 @@
<th>{% trans "User Interface" %}</th>
<th>{% trans "Graph" %}</th>
<th>{% trans "User Interface (red.)" %}
- <a href="{% url 'help' 'reduced_po' 1 %}" data-target="#modal-container" role="button"
data-toggle="modal"><img src="{{ STATIC_URL }}img/help.png" alt="help icon"></a>
+ <a href="{% url 'help' 'reduced_po' 1 %}" data-target="#modal-container" role="button"
data-toggle="modal"><img src="{% static 'img/help.png' %}" alt="help icon"></a>
</th>
<th>{% trans "Documentation" %}</th>
<th>{% trans "Graph" %}</th>
diff --git a/templates/release_list.html b/templates/release_list.html
index 5069b5d0..a1791418 100644
--- a/templates/release_list.html
+++ b/templates/release_list.html
@@ -1,5 +1,4 @@
{% extends "base.html" %}
-{% load i18n %}
{% block title %} {% trans "GNOME Releases" %} {% endblock %}
diff --git a/templates/stats_show.html b/templates/stats_show.html
index ce5fc8ad..bd6e9160 100644
--- a/templates/stats_show.html
+++ b/templates/stats_show.html
@@ -1,4 +1,4 @@
-{% load i18n stats_extras %}
+{% load stats_extras %}
{% for dname, stat in stats.items %}
{% with stat|first as pot_stat %}
@@ -8,11 +8,11 @@
<h3>{% trans pot_stat.domain.get_description %}
{% if pot_stat.get_type == "mallard" %}
- <span style="padding-top: 8px;" class="btn btn-action"><img src="{{ STATIC_URL
}}img/mallard.png" title="{% trans "This document is written in Mallard documentation format" %}"
alt="mallard icon"/></span>
+ <span style="padding-top: 8px;" class="btn btn-action"><img src="{% static 'img/mallard.png' %}"
title="{% trans "This document is written in Mallard documentation format" %}" alt="mallard icon"></span>
{% endif %}
{% if pot_stat.full_po %}
- <a href="{{ pot_stat.po_url }}" class="btn btn-action" title="{% trans 'Download POT file'
%}"><img src="{{ STATIC_URL }}img/download.png" alt="{% trans 'Download POT file' %}" /></a>
+ <a href="{{ pot_stat.po_url }}" class="btn btn-action" title="{% trans 'Download POT file'
%}"><img src="{% static 'img/download.png' %}" alt="{% trans 'Download POT file' %}"></a>
{% endif %}
</h3>
@@ -36,10 +36,10 @@
{% if msg.type == 'error' or msg.type == 'error-ext' %}
<div class="actions">
<a href="{{ module|browse_bugs:'error+pot+file' }}" target="_blank">
- <img src="{{ STATIC_URL }}img/search.png" alt="{% trans 'Search for similar
bugs before reporting it' %}" title="{% trans 'Search for similar bugs before reporting it' %}"/>
+ <img src="{% static 'img/search.png' %}" alt="{% trans 'Search for similar
bugs before reporting it' %}" title="{% trans 'Search for similar bugs before reporting it' %}">
</a>
<a href="{{ msg.report_bug_url }}" target="_blank">
- <img src="{{ STATIC_URL }}img/bug.png" alt="{% trans 'Report this bug' %}"
title="{% trans 'Report this bug' %}" />
+ <img src="{% static 'img/bug.png' %}" alt="{% trans 'Report this bug' %}"
title="{% trans 'Report this bug' %}">
</a>
</div>
{% endif %}
@@ -80,7 +80,7 @@
<td>{{ line|num_stats }}</td>
{% if pot_stat.full_po.fig_count %}
<td><a href="{% url 'docimages' module.name pot_stat.domain.name branch.name line.language.locale %}">
- <img src="{{ STATIC_URL }}img/figure.png" alt="{% trans "Display document figures" %}"></a>
+ <img src="{% static 'img/figure.png' %}" alt="{% trans 'Display document figures' %}"></a>
</td>
{% endif %}
<td style="width: 108px; text-align: center;">
diff --git a/templates/teams/team_base.html b/templates/teams/team_base.html
index 6e2d46fd..c86e2044 100644
--- a/templates/teams/team_base.html
+++ b/templates/teams/team_base.html
@@ -1,5 +1,4 @@
{# Variables 'team' and 'language' must be defined prior to calling this template #}
-{% load i18n %}
{% with team.get_description as lang %}
<div class="row">
@@ -8,7 +7,7 @@
<h2>{% trans "Details" %}
{% if can_edit_details %}
<a href="{% url 'team_edit' team.name %}">
- <img src="{{ STATIC_URL }}img/edit.png" alt="Edit"/>
+ <img src="{% static 'img/edit.png' %}" alt="Edit">
</a>
{% endif %}
</h2>
diff --git a/templates/teams/team_detail.html b/templates/teams/team_detail.html
index 34972e99..dedb2e3c 100644
--- a/templates/teams/team_detail.html
+++ b/templates/teams/team_detail.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-{% load i18n stats_extras %}
+{% load stats_extras %}
{% block extrahead %}
<link rel="alternate" type="application/rss+xml"
@@ -17,7 +17,7 @@ $(document).ready(function() {
var target_div = $("#togglable-" + this.id);
if (target_div.is(':visible')) {
target_div.hide();
- $(this).attr("src", "{{ STATIC_URL }}img/closed.png");
+ $(this).attr("src", "{% static 'img/closed.png' %}");
} else {
if (target_div.attr("class") == "empty") {
// Load the archive stats dynamically
@@ -25,7 +25,7 @@ $(document).ready(function() {
target_div.attr("class", "loaded");
}
target_div.show();
- $(this).attr("src", "{{ STATIC_URL }}img/open.png");
+ $(this).attr("src", "{% static 'img/open.png' %}");
}
});
});
@@ -72,7 +72,7 @@ $(document).ready(function() {
<p><strong>{% trans "Plural forms:" %}</strong> {{ lang.get_plurals }}</p>
- <h3><img class="toggler" id="{{ lang.locale|escapeat }}" title="{% trans 'Show/hide archived
translations' %}" src="{{ STATIC_URL }}img/closed.png" /> {% trans "Archives" %}</h3>
+ <h3><img class="toggler" id="{{ lang.locale|escapeat }}" title="{% trans 'Show/hide archived
translations' %}" src="{% static 'img/closed.png' %}"> {% trans "Archives" %}</h3>
<div id="togglable-{{ lang.locale|escapeat }}" class="empty" style="display:none;"
data-url="{% url 'language_release_archives' lang.locale %}"></div>
@@ -82,7 +82,7 @@ $(document).ready(function() {
<h2>{% trans "Team membership" %}</h2>
{% for group in mem_groups %}
- <h3>{% if group.id == 'inactive' %}<img class="toggler" id="{{ group.id }}" title="{% trans
'Show/hide inactive translations' %}" src="{{ STATIC_URL }}img/closed.png">{% endif %}
+ <h3>{% if group.id == 'inactive' %}<img class="toggler" id="{{ group.id }}" title="{% trans
'Show/hide inactive translations' %}" src="{% static 'img/closed.png' %}">{% endif %}
{{ group.title }}</h3>
<div id="togglable-{{ group.id }}">
{% if group.form %}
diff --git a/templates/teams/team_edit.html b/templates/teams/team_edit.html
index a20374b8..bfd5cad2 100644
--- a/templates/teams/team_edit.html
+++ b/templates/teams/team_edit.html
@@ -1,9 +1,9 @@
{% extends "base.html" %}
-{% load i18n %}
+
{% block title %}{{ team.get_description }}{% endblock %}
{% block extrahead %}
-<script src="{{ STATIC_URL }}js/autosize.min.js"></script>
+<script src="{% static 'js/autosize.min.js' %}"></script>
<script>
$(document).ready(function() {
autosize(document.querySelector('#id_presentation'));
diff --git a/templates/teams/team_list.html b/templates/teams/team_list.html
index 342ac301..3708ac08 100644
--- a/templates/teams/team_list.html
+++ b/templates/teams/team_list.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-{% load i18n people %}
+{% load people %}
{% block title %}{% trans "GNOME Translation Teams" %}{% endblock %}
diff --git a/templates/vertimus/activity_summary.html b/templates/vertimus/activity_summary.html
index a503d76c..c457fc72 100644
--- a/templates/vertimus/activity_summary.html
+++ b/templates/vertimus/activity_summary.html
@@ -1,9 +1,8 @@
{% extends "base.html" %}
-{% load i18n %}
{% load humanize %}
{% block extrahead %}
-<script src="{{ STATIC_URL }}js/jquery.tablesorter.min.js"></script>
+<script src="{% static 'js/jquery.tablesorter.min.js' %}"></script>
<script>
$(document).ready(function()
{
diff --git a/templates/vertimus/quality-check.html b/templates/vertimus/quality-check.html
index fc7bbccb..a02aa599 100644
--- a/templates/vertimus/quality-check.html
+++ b/templates/vertimus/quality-check.html
@@ -1,5 +1,4 @@
{% extends base %}
-{% load i18n %}
{% block title %}{% trans "Quality check results" %}{% endblock %}
diff --git a/templates/vertimus/vertimus_detail.html b/templates/vertimus/vertimus_detail.html
index 6b43c880..7a29273c 100644
--- a/templates/vertimus/vertimus_detail.html
+++ b/templates/vertimus/vertimus_detail.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-{% load i18n humanize people stats_extras vertimus %}
+{% load humanize people stats_extras vertimus %}
{% block title %}
{% blocktrans with module.get_description as name %}Module Translation: {{ name }}{% endblocktrans %}
@@ -10,7 +10,7 @@
tr.tr_author, tr.tr_sync_master { display: none; }
img.icons { width: 24px; height: 24px; margin: 0 0.7em; }
</style>
-<script src="{{ STATIC_URL }}js/autosize.min.js"></script>
+<script src="{% static 'js/autosize.min.js' %}"></script>
<script>
function updateForm() {
@@ -72,24 +72,24 @@ $(document).ready(function() {
<p>{{ module.get_comment|safe }}</p>
{% else %}
{% if not module.has_standard_vcs %}
- <p><em><img src="{{ STATIC_URL }}img/warn.png" alt="Warning logo" /> {{ non_standard_repo_msg }}</em></p>
+ <p><em><img src="{% static 'img/warn.png' %}" alt="Warning logo" /> {{ non_standard_repo_msg }}</em></p>
{% endif %}
{% endif %}
<div id="vertimus_stats">
<div><em><a class="btn btn-action" href="{{ pot_stats.pot_url }}" title="{% trans 'Download POT file' %}">
- <img src="{{ STATIC_URL }}img/download.png" alt="{% trans 'Download POT file' %}" /></a>
+ <img src="{% static 'img/download.png' %}" alt="{% trans 'Download POT file' %}" /></a>
{{ pot_stats.pot_text }}
</em></div>
<div style="margin-top: 5px;">
- <a class="btn btn-action" href="{{ po_url }}" title="{% trans 'Download PO file' %}"><img src="{{
STATIC_URL }}img/download.png" alt="{% trans 'Download PO file' %}"></a>
+ <a class="btn btn-action" href="{{ po_url }}" title="{% trans 'Download PO file' %}"><img src="{% static
'img/download.png' %}" alt="{% trans 'Download PO file' %}"></a>
{% if stats.fuzzy %}
- <a href="{% url 'stats-msgiddiff' stats.pk %}" title="{% trans 'PO file with inline diffs for fuzzy
strings' %}"><img class="icons" src="{{ STATIC_URL }}img/diff.png"></a>
+ <a href="{% url 'stats-msgiddiff' stats.pk %}" title="{% trans 'PO file with inline diffs for fuzzy
strings' %}"><img class="icons" src="{% static 'img/diff.png' %}"></a>
{% endif %}
{% if domain.dtype == 'doc' %}
<a href="{% url 'stats-quality-check' stats.pk %}" data-target="#modal-container"
role="button" data-toggle="modal" title="{% trans 'Quality checks' %}">
- <img class="icons" src="{{ STATIC_URL }}img/qa-icon.svg" alt="quality check icon"></a>
+ <img class="icons" src="{% static 'img/qa-icon.svg' %}" alt="quality check icon"></a>
{% endif %}
{% trans "PO file statistics:" %} <br>
<div id="stats_po">
@@ -116,11 +116,11 @@ $(document).ready(function() {
{% if po_url_reduced %}
<div style="display: inline-block; margin: 20px 0 5px 0;">
- <a class="btn btn-action" href="{{ po_url_reduced }}" title="{% trans "Download PO file" %}"><img
src="{{ STATIC_URL }}img/download.png" alt="{% trans "Download PO file" %}" /></a>
+ <a class="btn btn-action" href="{{ po_url_reduced }}" title="{% trans "Download PO file" %}"><img
src="{% static 'img/download.png' %}" alt="{% trans "Download PO file" %}" /></a>
{% trans "PO file statistics (reduced):" %}
<div style="display: inline-block;">
<span class="help_link"><a href="{% url 'help' 'reduced_po' 1 %}" data-target="#modal-container"
role="button" data-toggle="modal">
- <img src="{{ STATIC_URL }}img/help.png" alt="help icon" />
+ <img src="{% static 'img/help.png' %}" alt="help icon" />
</a></span>
</div>
<br />
@@ -156,7 +156,7 @@ $(document).ready(function() {
{% if other_states %}
<div class="errornote">
- <img src="{{ STATIC_URL }}img/warn.png" alt="Warning logo" />
+ <img src="{% static 'img/warn.png' %}" alt="Warning logo">
{% trans "On-going activities in same module:" %}
{% for st in other_states %}
<a href="{% url 'vertimus_by_ids' st.branch.pk st.domain.pk st.language.pk %}">{{ st.branch.name }}</a>
@@ -199,20 +199,20 @@ $(document).ready(function() {
{% endif %}
{% if action.file or action.comment %}
<a name="{{ action.id }}" href="#{{ action.id }}" title="{% trans 'Link to this comment' %}">
- <img alt="link comment icon" class="action_icons" src="{{ STATIC_URL }}img/share.png">
+ <img alt="link comment icon" class="action_icons" src="{% static 'img/share.png' %}">
</a>
{% endif %}
<a role="button" data-toggle="collapse" href="#{{ action.created|date:"Y_g_i_s" }}"
class="visible-xs-inline" aria-expanded="false" aria-controls="collapseExample2">
- <img alt="icon for action time" class="action_icons" src="{{ STATIC_URL }}img/clock.png">
+ <img alt="icon for action time" class="action_icons" src="{% static 'img/clock.png' %}">
</a>
{% if domain.dtype == 'doc' and action.has_po_file %}
<a href="{% url 'action-quality-check' action.pk %}" data-target="#modal-container"
role="button" data-toggle="modal" title="{% trans 'Quality checks' %}">
- <img class="action_icons" src="{{ STATIC_URL }}img/qa-icon.svg" alt="help icon">
+ <img class="action_icons" src="{% static 'img/qa-icon.svg' %}" alt="help icon">
</a>
{% endif %}
{% if action.sent_to_ml %}
- <img alt="mail icon sent" class="action_icons" src="{{ STATIC_URL }}img/mail.png" title="{%
trans 'This message was sent to the mailing list' %}">
+ <img alt="mail icon sent" class="action_icons" src="{% static 'img/mail.png' %}" title="{% trans
'This message was sent to the mailing list' %}">
{% endif %}
<div class="collapse" id="{{ action.created|date:"Y_g_i_s" }}">
{{ action.created|date:_("Y-m-d g:i a O") }}
@@ -307,7 +307,7 @@ $(document).ready(function() {
{% endif %}
{% endif %}
{% else %}
- <p><img src="{{ STATIC_URL }}img/warn.png"/> {% trans "This team is not using the translation
workflow." %}</p>
+ <p><img src="{% static 'img/warn.png' %}"> {% trans "This team is not using the translation
workflow." %}</p>
{% endif %}
</div>
{% endblock %}
diff --git a/templates/vertimus/vertimus_diff.html b/templates/vertimus/vertimus_diff.html
index bbe4722a..db710eee 100644
--- a/templates/vertimus/vertimus_diff.html
+++ b/templates/vertimus/vertimus_diff.html
@@ -1,12 +1,11 @@
{% extends "base.html" %}
-{% load i18n %}
{% block title %}
{% trans "Diff between po files" %}
{% endblock %}
{% block extrahead %}
- <link rel="stylesheet" href="{{ STATIC_URL }}css/difflib.css" />
+ <link rel="stylesheet" href="{% static 'css/difflib.css' %}" />
{% endblock %}
{% block content %}
diff --git a/vertimus/templatetags/vertimus.py b/vertimus/templatetags/vertimus.py
index 63c72d64..f34b4b6e 100644
--- a/vertimus/templatetags/vertimus.py
+++ b/vertimus/templatetags/vertimus.py
@@ -1,5 +1,6 @@
from django import template
from django.conf import settings
+from django.templatetags.static import static
from django.utils.html import format_html
register = template.Library()
@@ -16,8 +17,8 @@ def as_tr(field):
help_link = format_html(
'<span class="help_link">'
'<a href="{}" data-target="#modal-container" role="button" data-toggle="modal">'
- '<img src="{}img/help.png" alt="help icon">'
- '</a></span>', field.field.help_link, settings.STATIC_URL
+ '<img src="{}" alt="help icon">'
+ '</a></span>', field.field.help_link, static('img/help.png')
)
errors_html = ''
if field.errors:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]