diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-03-26 15:26:20 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-07-21 15:07:41 +0200 |
commit | 62b34d0afb55a5c5c7bc1da22f0c0d293ee3936d (patch) | |
tree | d4bbb36fbd4f23f3fe406cefcc3be0ba396d981e | |
parent | 18556dec8d2989f715d2251342aa4368fda857c8 (diff) | |
download | Ishtar-62b34d0afb55a5c5c7bc1da22f0c0d293ee3936d.tar.bz2 Ishtar-62b34d0afb55a5c5c7bc1da22f0c0d293ee3936d.zip |
♻️ django 3.2 deprecation: force_text -> force_str - templates: remove ifequal ; PIL: Image.ANTIALIAS -> Image.Resampling.LANCZOS
-rw-r--r-- | archaeological_warehouse/tests.py | 4 | ||||
-rw-r--r-- | bootstrap_datepicker/widgets.py | 6 | ||||
-rw-r--r-- | ishtar_common/models.py | 2 | ||||
-rw-r--r-- | ishtar_common/templates/blocks/bs_formset_snippet.html | 4 | ||||
-rw-r--r-- | ishtar_common/templates/blocks/comma_list.html | 2 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/blocks/shortcut_menu.html | 2 | ||||
-rw-r--r-- | ishtar_common/widgets.py | 8 |
7 files changed, 14 insertions, 14 deletions
diff --git a/archaeological_warehouse/tests.py b/archaeological_warehouse/tests.py index 4290e2c42..1a2b42053 100644 --- a/archaeological_warehouse/tests.py +++ b/archaeological_warehouse/tests.py @@ -489,7 +489,7 @@ class WarehouseTest(TestCase): def test_localisation_import(self): container_nb = models.Container.objects.count() - base_value = "A;42;allée 3\;2" + base_value = "A;42;allée 3\\;2" error = self.warehouse._add_localisations(None, base_value, return_errors=True) self.assertTrue(error) # no division set @@ -497,7 +497,7 @@ class WarehouseTest(TestCase): models.WarehouseDivisionLink.objects.create( container_type=ct, order=idx * 10, warehouse=self.warehouse ) - too_many_value = "A;42;allée 3\;2;5;42;3" + too_many_value = "A;42;allée 3\\;2;5;42;3" error = self.warehouse._add_localisations( None, too_many_value, return_errors=True ) diff --git a/bootstrap_datepicker/widgets.py b/bootstrap_datepicker/widgets.py index b84006056..908b61efe 100644 --- a/bootstrap_datepicker/widgets.py +++ b/bootstrap_datepicker/widgets.py @@ -9,7 +9,7 @@ from django.forms.widgets import DateTimeInput from django.utils.safestring import mark_safe from django.utils import translation from django.utils.html import conditional_escape -from django.utils.encoding import force_text +from django.utils.encoding import force_str logger = logging.getLogger(__name__) @@ -144,7 +144,7 @@ class DatePicker(DateTimeInput): input_attrs = self.build_attrs(attrs, extra_attrs) if value != '': # Only add the 'value' attribute if a value is non-empty. - input_attrs['value'] = force_text(self.format_value(value)) + input_attrs['value'] = force_str(self.format_value(value)) input_attrs = {key: conditional_escape(val) for key, val in input_attrs.items()} if not self.picker_id: @@ -162,7 +162,7 @@ class DatePicker(DateTimeInput): icon_attrs=flatatt(icon_attrs)) js = self.js_template % dict( picker_id=picker_id, options=json_dumps(self.options or {})) - return mark_safe(force_text(html + js)) + return mark_safe(force_str(html + js)) class DateField(forms.DateField): diff --git a/ishtar_common/models.py b/ishtar_common/models.py index e3f2b8b61..9a3eac46a 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -521,7 +521,7 @@ class ImageModel(models.Model, ImageContainerModel): def create_thumb(self, image, size): """Returns the image resized to fit inside a box of the given size""" - image.thumbnail(size, Image.ANTIALIAS) + image.thumbnail(size, Image.Resampling.LANCZOS) temp = BytesIO() image.save(temp, "jpeg") temp.seek(0) diff --git a/ishtar_common/templates/blocks/bs_formset_snippet.html b/ishtar_common/templates/blocks/bs_formset_snippet.html index cfc9bb37b..8ed958d1c 100644 --- a/ishtar_common/templates/blocks/bs_formset_snippet.html +++ b/ishtar_common/templates/blocks/bs_formset_snippet.html @@ -19,9 +19,9 @@ {% csrf_token %} {% for field in form.visible_fields %} - {% ifequal field.name "DELETE" %}{% with bs_col_width='col-2' %}{% include "blocks/bs_field_snippet.html" %}{% endwith %} + {% if field.name == "DELETE" %}{% with bs_col_width='col-2' %}{% include "blocks/bs_field_snippet.html" %}{% endwith %} {% else %}{% with bs_col_width='col-3' %}{% include "blocks/bs_field_snippet.html" %}{% endwith %} - {% endifequal %} + {% endif %} {% endfor %} {% if form.extra_render %} diff --git a/ishtar_common/templates/blocks/comma_list.html b/ishtar_common/templates/blocks/comma_list.html index 12fcd2b41..60aa6bacc 100644 --- a/ishtar_common/templates/blocks/comma_list.html +++ b/ishtar_common/templates/blocks/comma_list.html @@ -1 +1 @@ -{% load i18n %}{% if not forloop.last %}{% ifequal forloop.revcounter 2 %} {% trans "and" %} {% else %}{% trans ", "%}{% endifequal %}{% else %}{% trans "." %}{% endif %} +{% load i18n %}{% if not forloop.last %}{% if forloop.revcounter == 2 %} {% trans "and" %} {% else %}{% trans ", "%}{% endif %}{% else %}{% trans "." %}{% endif %} diff --git a/ishtar_common/templates/ishtar/blocks/shortcut_menu.html b/ishtar_common/templates/ishtar/blocks/shortcut_menu.html index 447deb573..1253aa12a 100644 --- a/ishtar_common/templates/ishtar/blocks/shortcut_menu.html +++ b/ishtar_common/templates/ishtar/blocks/shortcut_menu.html @@ -27,7 +27,7 @@ <div class="col-sm-6"> <select class='{{main_cls}} chosen-select' id='current_{{model_name}}'> <option class='normal' value=''>--</option> - {% for val, label, selected, cls in items %}<option{% if cls %} class='{{cls}}'{% endif %} value='{{val}}'{% if selected %} selected="selected"{% endif %}>{% ifequal cls 'basket' %} {% endifequal %}{% ifequal cls 'green' %} {% endifequal %}{% ifequal cls 'orange' %} {% endifequal %}{% ifequal cls 'red' %} {% endifequal %}{{label}}</option> + {% for val, label, selected, cls in items %}<option{% if cls %} class='{{cls}}'{% endif %} value='{{val}}'{% if selected %} selected="selected"{% endif %}>{% if cls == 'basket' %} {% endif %}{% if cls == 'green' %} {% endif %}{% if cls == 'orange' %} {% endif %}{% if cls == 'red' %} {% endif %}{{label}}</option> {% endfor %}</select> </div> {% with 'show-'|add:model_name as model_url%} diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py index a7a59d818..b96baee01 100644 --- a/ishtar_common/widgets.py +++ b/ishtar_common/widgets.py @@ -33,7 +33,7 @@ from django.forms.widgets import ( from django.template import loader from django.template.defaultfilters import slugify from django.urls import reverse, NoReverseMatch -from django.utils.encoding import smart_text +from django.utils.encoding import smart_str from django.utils.functional import lazy from django.utils.html import escape from django.utils.safestring import mark_safe @@ -796,7 +796,7 @@ class JQueryAutoComplete(forms.TextInput): hiddens = [] selects = [] if type(value) not in (list, tuple): - values = str(escape(smart_text(value))) + values = str(escape(smart_str(value))) values = values.replace("[", "").replace("]", "") values = values.split(",") else: @@ -998,7 +998,7 @@ class JQueryTown(forms.TextInput): hiddens = [] selects = [] if type(value) not in (list, tuple): - values = str(escape(smart_text(value))) + values = str(escape(smart_str(value))) values = values.replace("[", "").replace("]", "") values = values.split(",") else: @@ -1124,7 +1124,7 @@ class JQueryPersonOrganization(forms.TextInput): hiddens = [] selects = [] if type(value) not in (list, tuple): - values = str(escape(smart_text(value))) + values = str(escape(smart_str(value))) values = values.replace("[", "").replace("]", "") values = values.split(",") else: |