From 02d07cb83dbedffe98d29304de74aee79d04a110 Mon Sep 17 00:00:00 2001 From: sinavir Date: Thu, 19 Dec 2024 16:20:48 +0100 Subject: [PATCH] fix(trombonoscope): Breaking changes in django-avatar --- Ernestophone/urls.py | 5 +++-- trombonoscope/templates/trombonoscope/add_avatar.html | 2 +- trombonoscope/templates/trombonoscope/change_avatar.html | 4 ++-- .../templates/trombonoscope/changetrombonoscope.html | 4 ++-- trombonoscope/templates/trombonoscope/delete_avatar.html | 4 ++-- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Ernestophone/urls.py b/Ernestophone/urls.py index 26aa73b..4143a57 100644 --- a/Ernestophone/urls.py +++ b/Ernestophone/urls.py @@ -13,13 +13,13 @@ Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ + from django.conf import settings from django.conf.urls.i18n import i18n_patterns from django.conf.urls.static import static from django.contrib import admin from django.contrib.auth import views as auth_views from django.urls import include, path - from gestion import views as gestion_views urlpatterns = [] @@ -69,4 +69,5 @@ urlpatterns += i18n_patterns( ), prefix_default_language=False, ) -urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) +if settings.DEBUG: + urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/trombonoscope/templates/trombonoscope/add_avatar.html b/trombonoscope/templates/trombonoscope/add_avatar.html index 62b94e6..a2567b6 100644 --- a/trombonoscope/templates/trombonoscope/add_avatar.html +++ b/trombonoscope/templates/trombonoscope/add_avatar.html @@ -12,7 +12,7 @@

{% trans "Avatar courant: " %}

{% avatar user %} -
+ {{ upload_avatar_form.as_p }}

{% csrf_token %}

diff --git a/trombonoscope/templates/trombonoscope/change_avatar.html b/trombonoscope/templates/trombonoscope/change_avatar.html index 6d159f5..65c659e 100644 --- a/trombonoscope/templates/trombonoscope/change_avatar.html +++ b/trombonoscope/templates/trombonoscope/change_avatar.html @@ -19,7 +19,7 @@

{% trans "Tu n'as pas encore ajouté d'avatar. Le logo Ernestophone sera utilisé par defaut." %}

{% endif %} -
+ {{ upload_avatar_form.as_p }}

{% csrf_token %}

@@ -27,7 +27,7 @@ {% trans "Retour au profil"%} {% if avatars %} - {% trans "Supprimer l'avatar "%}{% trans "Supprimer l'avatar "%} {% endif %} {% endblock %} diff --git a/trombonoscope/templates/trombonoscope/changetrombonoscope.html b/trombonoscope/templates/trombonoscope/changetrombonoscope.html index c4ebc83..1bc138c 100644 --- a/trombonoscope/templates/trombonoscope/changetrombonoscope.html +++ b/trombonoscope/templates/trombonoscope/changetrombonoscope.html @@ -26,9 +26,9 @@ {% endif %}

- {% trans "Changer l'avatar "%} + {% trans "Changer l'avatar "%} {% if request.user|has_avatar %} -  {% trans "Supprimer l'avatar "%} +  {% trans "Supprimer l'avatar "%} {% endif %}

diff --git a/trombonoscope/templates/trombonoscope/delete_avatar.html b/trombonoscope/templates/trombonoscope/delete_avatar.html index 0a7e521..db36f88 100644 --- a/trombonoscope/templates/trombonoscope/delete_avatar.html +++ b/trombonoscope/templates/trombonoscope/delete_avatar.html @@ -10,12 +10,12 @@

{% trans "Suppression de l'avatar" %} :

{% if not avatars %} - {% url 'avatar_change' as avatar_change_url %} + {% url 'avatar:change' as avatar_change_url %}

{% trans "Vous n'avez pas d'avatar à supprimer."%}

{% trans "Télécharger un avatar" %} {% trans "Retour au profil"%} {% else %}

{% trans "Séléctione l'avatar pour le supprimer" %}

-
+ {% for field in delete_avatar_form %}