Also show link to image usage page on confirm_delete page

pull/3941/merge
Kees Hink 2017-10-18 16:06:23 +01:00 zatwierdzone przez Matt Westcott
rodzic fd9d36d66b
commit c03f43a70b
36 zmienionych plików z 145 dodań i 127 usunięć

Wyświetl plik

@ -6,6 +6,7 @@ Changelog
* Removed support for Python 2.7, Django 1.8 and Django 1.10
* Added hidden field to the form builder (Ross Crawford-d'Heureuse)
* Image usage count now shows on delete confirmation page when WAGTAIL_USAGE_COUNT_ENABLED is active (Kees Hink)
* Fix: Do not remove stopwords when generating slugs from non-ASCII titles, to avoid issues with incorrect word boundaries (Sævar Öfjörð Magnússon)

Wyświetl plik

@ -396,6 +396,8 @@ Usage for images, documents and snippets
When enabled Wagtail shows where a particular image, document or snippet is being used on your site (disabled by default). A link will appear on the edit page showing you which pages they have been used on.
This link is also shown on the delete page, above the "Delete" button.
.. note::
The usage count only applies to direct (database) references. Using documents, images and snippets within StreamFields or rich text fields will not be taken into account.

Wyświetl plik

@ -14,6 +14,7 @@ Other features
~~~~~~~~~~~~~~
* Added hidden field to the form builder (Ross Crawford-d'Heureuse)
* Image usage count now shows on delete confirmation page when WAGTAIL_USAGE_COUNT_ENABLED is active (Kees Hink)
Bug fixes

Wyświetl plik

@ -1005,10 +1005,10 @@ msgid "Sat"
msgstr "Ds"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "Utilitzat %(useage_count)s vegada"
msgstr[1] "Utilitzat %(useage_count)s vegades"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "Utilitzat %(usage_count)s vegada"
msgstr[1] "Utilitzat %(usage_count)s vegades"
msgid "Edit your account"
msgstr "Modifica el teu compte d'usuari"

Wyświetl plik

@ -694,11 +694,11 @@ msgid "Sat"
msgstr "so"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "Použito %(useage_count)s-krát"
msgstr[1] "Použito %(useage_count)s-krát"
msgstr[2] "Použito %(useage_count)s-krát"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "Použito %(usage_count)s-krát"
msgstr[1] "Použito %(usage_count)s-krát"
msgstr[2] "Použito %(usage_count)s-krát"
msgid "Log out"
msgstr "Odhlásit"

Wyświetl plik

@ -1113,10 +1113,10 @@ msgid "Sat"
msgstr "Sa"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "%(useage_count)s mal benutzt"
msgstr[1] "%(useage_count)s mal benutzt"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "%(usage_count)s mal benutzt"
msgstr[1] "%(usage_count)s mal benutzt"
msgid "Edit your account"
msgstr "Bearbeiten Sie Ihr Konto"

Wyświetl plik

@ -1006,10 +1006,10 @@ msgid "Sat"
msgstr "Σαβ"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "Χρησιμοποιήθηκε %(useage_count)s φορά"
msgstr[1] "Χρησιμοποιήθηκε %(useage_count)s φορές"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "Χρησιμοποιήθηκε %(usage_count)s φορά"
msgstr[1] "Χρησιμοποιήθηκε %(usage_count)s φορές"
msgid "Edit your account"
msgstr "Επεξεργαστείτε το λογαριασμό σας"

Wyświetl plik

@ -1357,8 +1357,8 @@ msgstr ""
#: templates/wagtailadmin/shared/header.html:42
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] ""
msgstr[1] ""

Wyświetl plik

@ -1092,10 +1092,10 @@ msgid "Sat"
msgstr "Sáb"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "Utilizado %(useage_count)s vez"
msgstr[1] "Utilizado %(useage_count)s veces"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "Utilizado %(usage_count)s vez"
msgstr[1] "Utilizado %(usage_count)s veces"
msgid "Edit your account"
msgstr "Editar tu cuenta"

Wyświetl plik

@ -1015,9 +1015,9 @@ msgid "Sat"
msgstr "شنبه"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "%(useage_count)s بار استفاده شد"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "%(usage_count)s بار استفاده شد"
msgid "Edit your account"
msgstr "ویرایش حساب شما"

Wyświetl plik

@ -924,10 +924,10 @@ msgid "Sat"
msgstr "La"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "Käytetty %(useage_count)s kerran"
msgstr[1] "Käytetty %(useage_count)s kertaa"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "Käytetty %(usage_count)s kerran"
msgstr[1] "Käytetty %(usage_count)s kertaa"
msgid "Edit your account"
msgstr "Muokkaa tiliäsi"

Wyświetl plik

@ -1082,10 +1082,10 @@ msgid "Sat"
msgstr "Sam"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "Utilisé %(useage_count)s fois"
msgstr[1] "Utilisé %(useage_count)s fois"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "Utilisé %(usage_count)s fois"
msgstr[1] "Utilisé %(usage_count)s fois"
msgid "Edit your account"
msgstr "Modifiez votre compte"

Wyświetl plik

@ -891,10 +891,10 @@ msgid "Sat"
msgstr "Sa"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "Usado %(useage_count)s vez"
msgstr[1] "Usado %(useage_count)s veces"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "Usado %(usage_count)s vez"
msgstr[1] "Usado %(usage_count)s veces"
msgid "Edit your account"
msgstr "Editar a túa conta"

Wyświetl plik

@ -638,10 +638,10 @@ msgid "Sat"
msgstr "שבת"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "היה בשימוש פעם %(useage_count)s"
msgstr[1] "היה בשימוש %(useage_count)s פעמים"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "היה בשימוש פעם %(usage_count)s"
msgstr[1] "היה בשימוש %(usage_count)s פעמים"
msgid "Edit your account"
msgstr "ערכו את חשבונכם"

Wyświetl plik

@ -1065,9 +1065,9 @@ msgid "Sat"
msgstr "Sab"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "Digunakan %(useage_count)s kali"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "Digunakan %(usage_count)s kali"
msgid "Edit your account"
msgstr "Ubah akun Anda"

Wyświetl plik

@ -1041,10 +1041,10 @@ msgid "Sat"
msgstr "Lau"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "Notað %(useage_count)s sinni"
msgstr[1] "Notað %(useage_count)s sinnum"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "Notað %(usage_count)s sinni"
msgstr[1] "Notað %(usage_count)s sinnum"
msgid "Edit your account"
msgstr "Breyta reikningnum þínum"

Wyświetl plik

@ -1089,10 +1089,10 @@ msgid "Sat"
msgstr "Sab"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] " Usato %(useage_count)s volta"
msgstr[1] "Usato %(useage_count)s volte"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] " Usato %(usage_count)s volta"
msgstr[1] "Usato %(usage_count)s volte"
msgid "Edit your account"
msgstr "Modifica il tuo account"

Wyświetl plik

@ -765,9 +765,9 @@ msgid "Sat"
msgstr "土曜"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "%(useage_count)s回使用"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "%(usage_count)s回使用"
msgid "Edit your account"
msgstr "アカウント設定"

Wyświetl plik

@ -1010,9 +1010,9 @@ msgid "Sat"
msgstr "토요일"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "%(useage_count)s 번 사용"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "%(usage_count)s 번 사용"
msgid "Edit your account"
msgstr "당신의 계정 변경"

Wyświetl plik

@ -1085,11 +1085,11 @@ msgid "Sat"
msgstr "Šeš"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "Panaudota %(useage_count)s kartą"
msgstr[1] "Panaudota %(useage_count)s kartus"
msgstr[2] "Panaudota %(useage_count)s kartų"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "Panaudota %(usage_count)s kartą"
msgstr[1] "Panaudota %(usage_count)s kartus"
msgstr[2] "Panaudota %(usage_count)s kartų"
msgid "Edit your account"
msgstr "Redaguoti savo vartotoją"

Wyświetl plik

@ -691,11 +691,11 @@ msgid "Sat"
msgstr "S"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "Lietots %(useage_count)s reizi"
msgstr[1] "Lietots %(useage_count)s reizi"
msgstr[2] "Lietots %(useage_count)s reizes"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "Lietots %(usage_count)s reizi"
msgstr[1] "Lietots %(usage_count)s reizi"
msgstr[2] "Lietots %(usage_count)s reizes"
msgid "Edit your account"
msgstr "Mainīt konta iestatījumus"

Wyświetl plik

@ -1072,10 +1072,10 @@ msgid "Sat"
msgstr "Lør"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "Brukt %(useage_count)s gang"
msgstr[1] "Brukt %(useage_count)s ganger"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "Brukt %(usage_count)s gang"
msgstr[1] "Brukt %(usage_count)s ganger"
msgid "Edit your account"
msgstr "Endre din konto"

Wyświetl plik

@ -797,10 +797,10 @@ msgid "Sat"
msgstr "Za"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "%(useage_count)s keer gebruikt"
msgstr[1] "%(useage_count)s keer gebruikt"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "%(usage_count)s keer gebruikt"
msgstr[1] "%(usage_count)s keer gebruikt"
msgid "Edit your account"
msgstr "Bewerk uw account"

Wyświetl plik

@ -1087,10 +1087,10 @@ msgid "Sat"
msgstr "Za"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "%(useage_count)s keer gebruikt"
msgstr[1] "%(useage_count)s keer gebruikt"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "%(usage_count)s keer gebruikt"
msgstr[1] "%(usage_count)s keer gebruikt"
msgid "Edit your account"
msgstr "Wijzig uw account"

Wyświetl plik

@ -1134,12 +1134,12 @@ msgid "Sat"
msgstr "Sob"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "Użyto %(useage_count)s raz"
msgstr[1] "Użyto %(useage_count)s razy"
msgstr[2] "Użyto %(useage_count)s razy"
msgstr[3] "Użyto %(useage_count)s razy"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "Użyto %(usage_count)s raz"
msgstr[1] "Użyto %(usage_count)s razy"
msgstr[2] "Użyto %(usage_count)s razy"
msgstr[3] "Użyto %(usage_count)s razy"
msgid "Edit your account"
msgstr "Edytuj swoje konto"

Wyświetl plik

@ -1086,10 +1086,10 @@ msgid "Sat"
msgstr "Sáb"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "Usado %(useage_count)s vez"
msgstr[1] "Usado %(useage_count)s vezes"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "Usado %(usage_count)s vez"
msgstr[1] "Usado %(usage_count)s vezes"
msgid "Edit your account"
msgstr "Edite sua conta"

Wyświetl plik

@ -932,10 +932,10 @@ msgid "Sat"
msgstr "Sáb"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "Usado %(useage_count)s vez"
msgstr[1] "%(useage_count)s utilizações"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "Usado %(usage_count)s vez"
msgstr[1] "%(usage_count)s utilizações"
msgid "Edit your account"
msgstr "Alterar a sua conta"

Wyświetl plik

@ -1101,11 +1101,11 @@ msgid "Sat"
msgstr "S"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "%(useage_count)s utilizăre"
msgstr[1] "%(useage_count)s utilizări"
msgstr[2] "%(useage_count)s utilizări"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "%(usage_count)s utilizăre"
msgstr[1] "%(usage_count)s utilizări"
msgstr[2] "%(usage_count)s utilizări"
msgid "Edit your account"
msgstr "Editează contul utilizator"

Wyświetl plik

@ -1162,12 +1162,12 @@ msgid "Sat"
msgstr "Сб"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "Использовано %(useage_count)s раз"
msgstr[1] "Использовано %(useage_count)s раз"
msgstr[2] "Использовано %(useage_count)s раз"
msgstr[3] "Использовано %(useage_count)s раз"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "Использовано %(usage_count)s раз"
msgstr[1] "Использовано %(usage_count)s раз"
msgstr[2] "Использовано %(usage_count)s раз"
msgstr[3] "Использовано %(usage_count)s раз"
msgid "Edit your account"
msgstr "Редактировать ваш аккаунт"

Wyświetl plik

@ -822,11 +822,11 @@ msgid "Sat"
msgstr "So"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "Použité %(useage_count)s krát"
msgstr[1] "Použité %(useage_count)s krát"
msgstr[2] "Použité %(useage_count)s krát"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "Použité %(usage_count)s krát"
msgstr[1] "Použité %(usage_count)s krát"
msgstr[2] "Použité %(usage_count)s krát"
msgid "Edit your account"
msgstr "Upraviť váš účet"

Wyświetl plik

@ -797,12 +797,12 @@ msgid "Sat"
msgstr "Sob"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "Število uporab: %(useage_count)s"
msgstr[1] "Število uporab: %(useage_count)s"
msgstr[2] "Število uporab: %(useage_count)s"
msgstr[3] "Število uporab: %(useage_count)s"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "Število uporab: %(usage_count)s"
msgstr[1] "Število uporab: %(usage_count)s"
msgstr[2] "Število uporab: %(usage_count)s"
msgstr[3] "Število uporab: %(usage_count)s"
msgid "Edit your account"
msgstr "Uredite vaš račun"

Wyświetl plik

@ -1079,10 +1079,10 @@ msgid "Sat"
msgstr "Lör"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "Använd %(useage_count)s gång"
msgstr[1] "Använd %(useage_count)s gånger"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "Använd %(usage_count)s gång"
msgstr[1] "Använd %(usage_count)s gånger"
msgid "Edit your account"
msgstr "Editera ditt konto"

Wyświetl plik

@ -1012,9 +1012,9 @@ msgid "Sat"
msgstr "周六"
#, python-format
msgid "Used %(useage_count)s time"
msgid_plural "Used %(useage_count)s times"
msgstr[0] "已使用%(useage_count)s次"
msgid "Used %(usage_count)s time"
msgid_plural "Used %(usage_count)s times"
msgstr[0] "已使用%(usage_count)s次"
msgid "Edit your account"
msgstr "编辑账户"

Wyświetl plik

@ -39,7 +39,7 @@
{% usage_count_enabled as uc_enabled %}
{% if uc_enabled and usage_object %}
<div class="usagecount">
<a href="{{ usage_object.usage_url }}">{% blocktrans count useage_count=usage_object.get_usage.count %}Used {{ useage_count }} time{% plural %}Used {{ useage_count }} times{% endblocktrans %}</a>
<a href="{{ usage_object.usage_url }}">{% blocktrans count usage_count=usage_object.get_usage.count %}Used {{ usage_count }} time{% plural %}Used {{ usage_count }} times{% endblocktrans %}</a>
</div>
{% endif %}
{% if add_link %}

Wyświetl plik

@ -1,6 +1,5 @@
{% extends "wagtailadmin/base.html" %}
{% load wagtailimages_tags %}
{% load i18n %}
{% load wagtailimages_tags i18n wagtailadmin_tags %}
{% block titletag %}{% trans "Delete image" %}{% endblock %}
{% block content %}
@ -12,6 +11,12 @@
{% image image max-800x600 %}
</div>
<div class="col6">
{% usage_count_enabled as uc_enabled %}
{% if uc_enabled %}
<div class="usagecount">
<a href="{{ image.usage_url }}">{% blocktrans count usage_count=image.get_usage.count %}Used {{ usage_count }} time{% plural %}Used {{ usage_count }} times{% endblocktrans %}</a>
</div>
{% endif %}
<p>{% trans "Are you sure you want to delete this image?" %}</p>
<form action="{% url 'wagtailimages:delete' image.id %}" method="POST">
{% csrf_token %}

Wyświetl plik

@ -481,10 +481,19 @@ class TestImageDeleteView(TestCase, WagtailTestUtils):
def post(self, post_data={}):
return self.client.post(reverse('wagtailimages:delete', args=(self.image.id,)), post_data)
@override_settings(WAGTAIL_USAGE_COUNT_ENABLED=False)
def test_simple(self):
response = self.get()
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'wagtailimages/images/confirm_delete.html')
self.assertNotIn('Used ', str(response.content))
@override_settings(WAGTAIL_USAGE_COUNT_ENABLED=True)
def test_usage_link(self):
response = self.get()
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'wagtailimages/images/confirm_delete.html')
self.assertIn('Used 0 times', str(response.content))
def test_delete(self):
response = self.post()