From 8c57eb8096a0fc245951a39f1f53cb337e3e5aa1 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Doderlein Date: Tue, 7 Nov 2023 15:01:10 +0100 Subject: [PATCH] Update to Django 4.2 (need to fix API) --- apps/api/urls.py | 3 +- ...3_alter_note_polymorphic_ctype_and_more.py | 36 +++++++++++++++++++ apps/note/templates/note/amount_input.html | 7 +++- note_kfet/settings/base.py | 4 +++ requirements.txt | 1 + 5 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 apps/note/migrations/0003_alter_note_polymorphic_ctype_and_more.py diff --git a/apps/api/urls.py b/apps/api/urls.py index 4f27185..ee8c34e 100644 --- a/apps/api/urls.py +++ b/apps/api/urls.py @@ -2,7 +2,8 @@ # SPDX-License-Identifier: GPL-3.0-or-later from django.conf import settings -from django.conf.urls import url, include +from django.conf.urls import include +from django.urls import re_path as url from rest_framework import routers from .views import UserInformationView diff --git a/apps/note/migrations/0003_alter_note_polymorphic_ctype_and_more.py b/apps/note/migrations/0003_alter_note_polymorphic_ctype_and_more.py new file mode 100644 index 0000000..0873339 --- /dev/null +++ b/apps/note/migrations/0003_alter_note_polymorphic_ctype_and_more.py @@ -0,0 +1,36 @@ +# Generated by Django 4.2.7 on 2023-11-07 13:06 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + dependencies = [ + ("contenttypes", "0002_remove_content_type_name"), + ("note", "0002_special_note"), + ] + + operations = [ + migrations.AlterField( + model_name="note", + name="polymorphic_ctype", + field=models.ForeignKey( + editable=False, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="polymorphic_%(app_label)s.%(class)s_set+", + to="contenttypes.contenttype", + ), + ), + migrations.AlterField( + model_name="transaction", + name="polymorphic_ctype", + field=models.ForeignKey( + editable=False, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="polymorphic_%(app_label)s.%(class)s_set+", + to="contenttypes.contenttype", + ), + ), + ] diff --git a/apps/note/templates/note/amount_input.html b/apps/note/templates/note/amount_input.html index d487311..3da9ac4 100644 --- a/apps/note/templates/note/amount_input.html +++ b/apps/note/templates/note/amount_input.html @@ -9,7 +9,12 @@ SPDX-License-Identifier: GPL-3.0-or-later name="{{ widget.name }}" {# Other attributes are loaded #} {% for name, value in widget.attrs.items %} - {% ifnotequal value False %}{{ name }}{% ifnotequal value True %}="{{ value|stringformat:'s' }}"{% endifnotequal %}{% endifnotequal %} + {% if value != False %} + {{ name }} + {% if value != True %} + ="{{ value|stringformat:'s' }}" + {% endif %} + {% endif %} {% endfor %}>
diff --git a/note_kfet/settings/base.py b/note_kfet/settings/base.py index 2a99908..8fb3094 100644 --- a/note_kfet/settings/base.py +++ b/note_kfet/settings/base.py @@ -40,6 +40,8 @@ INSTALLED_APPS = [ # External apps 'bootstrap_datepicker_plus', 'colorfield', + 'bootstrap4', + 'crispy_bootstrap4', 'crispy_forms', 'django_htcpcp_tea', 'django_tables2', @@ -294,3 +296,5 @@ PHONENUMBER_DEFAULT_REGION = 'FR' # We add custom information to CAS, in order to give a normalized name to other services CAS_AUTH_CLASS = 'member.auth.CustomAuthUser' + +DEFAULT_AUTO_FIELD='django.db.models.AutoField' diff --git a/requirements.txt b/requirements.txt index 598a3b7..2728a7c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,3 +15,4 @@ django-tables2 python-memcached phonenumbers Pillow +crispy_bootstrap4