fix(trombonoscope): Breaking changes in django-avatar

This commit is contained in:
sinavir 2024-12-19 16:20:48 +01:00
parent fbb7cbe11a
commit 02d07cb83d
No known key found for this signature in database
5 changed files with 10 additions and 9 deletions

View file

@ -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)

View file

@ -12,7 +12,7 @@
<p>{% trans "Avatar courant: " %}</p>
{% avatar user %}
<form enctype="multipart/form-data" method="POST" action="{% url 'avatar_add' %}">
<form enctype="multipart/form-data" method="POST" action="{% url 'avatar:add' %}">
{{ upload_avatar_form.as_p }}
<p>{% csrf_token %}<input type="submit" value="{% trans "Ajouter une nouvelle image" %}" /></p>
</form>

View file

@ -19,7 +19,7 @@
<p>{% trans "Tu n'as pas encore ajouté d'avatar. Le logo Ernestophone sera utilisé par defaut." %}</p>
{% endif %}
<form enctype="multipart/form-data" method="POST" action="{% url 'avatar_add' %}">
<form enctype="multipart/form-data" method="POST" action="{% url 'avatar:add' %}">
{{ upload_avatar_form.as_p }}
<p>{% csrf_token %}<input type="submit" value="{% trans "Modifier mon avatar" %}" /></p>
</form>
@ -27,7 +27,7 @@
<a href="{% url "trombonoscope:change" %}" class="button alt">{% trans "Retour au profil"%}</a>
{% if avatars %}
&nbsp;<a class="button alt" href="{% url 'avatar_delete' %}">{% trans "Supprimer l'avatar "%}</a>
&nbsp;<a class="button alt" href="{% url 'avatar:delete' %}">{% trans "Supprimer l'avatar "%}</a>
{% endif %}
</div></div></div></section></div>
{% endblock %}

View file

@ -26,9 +26,9 @@
{% endif %}
<p>
<a class="button alt" href="{% url 'avatar_change' %}">{% trans "Changer l'avatar "%}</a>
<a class="button alt" href="{% url 'avatar:change' %}">{% trans "Changer l'avatar "%}</a>
{% if request.user|has_avatar %}
&nbsp;<a class="button alt" href="{% url 'avatar_delete' %}">{% trans "Supprimer l'avatar "%}</a>
&nbsp;<a class="button alt" href="{% url 'avatar:delete' %}">{% trans "Supprimer l'avatar "%}</a>
{% endif %}
</p>

View file

@ -10,12 +10,12 @@
<div class="6u 12u$(small)">
<h2>{% trans "Suppression de l'avatar" %} :</h2>
{% if not avatars %}
{% url 'avatar_change' as avatar_change_url %}
{% url 'avatar:change' as avatar_change_url %}
<p>{% trans "Vous n'avez pas d'avatar à supprimer."%}</p>
<a href="{{ avatar_change_url }}" class="button">{% trans "Télécharger un avatar" %}</a>&nbsp;<a href="{% url "trombonoscope:change" %}" class="button alt">{% trans "Retour au profil"%}</a>
{% else %}
<p>{% trans "Séléctione l'avatar pour le supprimer" %}</p>
<form method="POST" action="{% url 'avatar_delete' %}">
<form method="POST" action="{% url 'avatar:delete' %}">
{% for field in delete_avatar_form %}