mirror of https://gitlab.crans.org/bde/nk20
Allow you to delete the profile picture
This commit is contained in:
parent
201d6b114a
commit
925e0f26f5
|
@ -138,6 +138,9 @@ class ImageForm(forms.Form):
|
||||||
|
|
||||||
return cleaned_data
|
return cleaned_data
|
||||||
|
|
||||||
|
def is_valid(self):
|
||||||
|
return super().is_valid() or super().clean().get('image') is None
|
||||||
|
|
||||||
|
|
||||||
class ClubForm(forms.ModelForm):
|
class ClubForm(forms.ModelForm):
|
||||||
def clean(self):
|
def clean(self):
|
||||||
|
|
|
@ -14,6 +14,9 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
<form method="post" enctype="multipart/form-data" id="formUpload">
|
<form method="post" enctype="multipart/form-data" id="formUpload">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form |crispy }}
|
{{ form |crispy }}
|
||||||
|
{% if user.note.display_image != "pic/default.png" %}
|
||||||
|
<input type="submit" class="btn btn-primary" value="{% trans "Remove" %}">
|
||||||
|
{% endif %}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<!-- MODAL TO CROP THE IMAGE -->
|
<!-- MODAL TO CROP THE IMAGE -->
|
||||||
|
|
|
@ -326,12 +326,15 @@ class PictureUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin, Det
|
||||||
"""Save image to note"""
|
"""Save image to note"""
|
||||||
image = form.cleaned_data['image']
|
image = form.cleaned_data['image']
|
||||||
|
|
||||||
# Rename as a PNG or GIF
|
if image is None:
|
||||||
extension = image.name.split(".")[-1]
|
image = "pic/default.png"
|
||||||
if extension == "gif":
|
|
||||||
image.name = "{}_pic.gif".format(self.object.note.pk)
|
|
||||||
else:
|
else:
|
||||||
image.name = "{}_pic.png".format(self.object.note.pk)
|
# Rename as a PNG or GIF
|
||||||
|
extension = image.name.split(".")[-1]
|
||||||
|
if extension == "gif":
|
||||||
|
image.name = "{}_pic.gif".format(self.object.note.pk)
|
||||||
|
else:
|
||||||
|
image.name = "{}_pic.png".format(self.object.note.pk)
|
||||||
|
|
||||||
# Save
|
# Save
|
||||||
self.object.note.display_image = image
|
self.object.note.display_image = image
|
||||||
|
|
|
@ -247,6 +247,7 @@ msgid "The validation of the activity is pending."
|
||||||
msgstr "La validation de cette activité est en attente."
|
msgstr "La validation de cette activité est en attente."
|
||||||
|
|
||||||
#: apps/activity/tables.py:43 apps/treasury/tables.py:107
|
#: apps/activity/tables.py:43 apps/treasury/tables.py:107
|
||||||
|
#: apps/member/templates/member/picture_update.html:18
|
||||||
msgid "Remove"
|
msgid "Remove"
|
||||||
msgstr "Supprimer"
|
msgstr "Supprimer"
|
||||||
|
|
||||||
|
@ -262,13 +263,13 @@ msgstr "supprimer"
|
||||||
msgid "Type"
|
msgid "Type"
|
||||||
msgstr "Type"
|
msgstr "Type"
|
||||||
|
|
||||||
#: apps/activity/tables.py:84 apps/member/forms.py:193
|
#: apps/activity/tables.py:84 apps/member/forms.py:196
|
||||||
#: apps/registration/forms.py:92 apps/treasury/forms.py:131
|
#: apps/registration/forms.py:92 apps/treasury/forms.py:131
|
||||||
#: apps/wei/forms/registration.py:104
|
#: apps/wei/forms/registration.py:104
|
||||||
msgid "Last name"
|
msgid "Last name"
|
||||||
msgstr "Nom de famille"
|
msgstr "Nom de famille"
|
||||||
|
|
||||||
#: apps/activity/tables.py:86 apps/member/forms.py:198
|
#: apps/activity/tables.py:86 apps/member/forms.py:201
|
||||||
#: apps/note/templates/note/transaction_form.html:138
|
#: apps/note/templates/note/transaction_form.html:138
|
||||||
#: apps/registration/forms.py:97 apps/treasury/forms.py:133
|
#: apps/registration/forms.py:97 apps/treasury/forms.py:133
|
||||||
#: apps/wei/forms/registration.py:109
|
#: apps/wei/forms/registration.py:109
|
||||||
|
@ -562,30 +563,30 @@ msgstr "Taille maximale : 2 Mo"
|
||||||
msgid "This image cannot be loaded."
|
msgid "This image cannot be loaded."
|
||||||
msgstr "Cette image ne peut pas être chargée."
|
msgstr "Cette image ne peut pas être chargée."
|
||||||
|
|
||||||
#: apps/member/forms.py:148 apps/member/views.py:102
|
#: apps/member/forms.py:151 apps/member/views.py:102
|
||||||
#: apps/registration/forms.py:34 apps/registration/views.py:266
|
#: apps/registration/forms.py:34 apps/registration/views.py:266
|
||||||
msgid "An alias with a similar name already exists."
|
msgid "An alias with a similar name already exists."
|
||||||
msgstr "Un alias avec un nom similaire existe déjà."
|
msgstr "Un alias avec un nom similaire existe déjà."
|
||||||
|
|
||||||
#: apps/member/forms.py:172
|
#: apps/member/forms.py:175
|
||||||
msgid "Inscription paid by Société Générale"
|
msgid "Inscription paid by Société Générale"
|
||||||
msgstr "Inscription payée par la Société générale"
|
msgstr "Inscription payée par la Société générale"
|
||||||
|
|
||||||
#: apps/member/forms.py:174
|
#: apps/member/forms.py:177
|
||||||
msgid "Check this case if the Société Générale paid the inscription."
|
msgid "Check this case if the Société Générale paid the inscription."
|
||||||
msgstr "Cochez cette case si la Société Générale a payé l'inscription."
|
msgstr "Cochez cette case si la Société Générale a payé l'inscription."
|
||||||
|
|
||||||
#: apps/member/forms.py:179 apps/registration/forms.py:79
|
#: apps/member/forms.py:182 apps/registration/forms.py:79
|
||||||
#: apps/wei/forms/registration.py:91
|
#: apps/wei/forms/registration.py:91
|
||||||
msgid "Credit type"
|
msgid "Credit type"
|
||||||
msgstr "Type de rechargement"
|
msgstr "Type de rechargement"
|
||||||
|
|
||||||
#: apps/member/forms.py:180 apps/registration/forms.py:80
|
#: apps/member/forms.py:183 apps/registration/forms.py:80
|
||||||
#: apps/wei/forms/registration.py:92
|
#: apps/wei/forms/registration.py:92
|
||||||
msgid "No credit"
|
msgid "No credit"
|
||||||
msgstr "Pas de rechargement"
|
msgstr "Pas de rechargement"
|
||||||
|
|
||||||
#: apps/member/forms.py:182
|
#: apps/member/forms.py:185
|
||||||
msgid "You can credit the note of the user."
|
msgid "You can credit the note of the user."
|
||||||
msgstr "Vous pouvez créditer la note de l'utilisateur·ice avant l'adhésion."
|
msgstr "Vous pouvez créditer la note de l'utilisateur·ice avant l'adhésion."
|
||||||
|
|
||||||
|
@ -594,17 +595,17 @@ msgstr "Vous pouvez créditer la note de l'utilisateur·ice avant l'adhésion."
|
||||||
msgid "Credit amount"
|
msgid "Credit amount"
|
||||||
msgstr "Montant à créditer"
|
msgstr "Montant à créditer"
|
||||||
|
|
||||||
#: apps/member/forms.py:203 apps/note/templates/note/transaction_form.html:144
|
#: apps/member/forms.py:206 apps/note/templates/note/transaction_form.html:144
|
||||||
#: apps/registration/forms.py:102 apps/treasury/forms.py:135
|
#: apps/registration/forms.py:102 apps/treasury/forms.py:135
|
||||||
#: apps/wei/forms/registration.py:114
|
#: apps/wei/forms/registration.py:114
|
||||||
msgid "Bank"
|
msgid "Bank"
|
||||||
msgstr "Banque"
|
msgstr "Banque"
|
||||||
|
|
||||||
#: apps/member/forms.py:230
|
#: apps/member/forms.py:233
|
||||||
msgid "User"
|
msgid "User"
|
||||||
msgstr "Utilisateur·ice"
|
msgstr "Utilisateur·ice"
|
||||||
|
|
||||||
#: apps/member/forms.py:244
|
#: apps/member/forms.py:247
|
||||||
msgid "Roles"
|
msgid "Roles"
|
||||||
msgstr "Rôles"
|
msgstr "Rôles"
|
||||||
|
|
||||||
|
@ -1153,11 +1154,11 @@ msgstr "Introspection :"
|
||||||
msgid "Show my applications"
|
msgid "Show my applications"
|
||||||
msgstr "Voir mes applications"
|
msgstr "Voir mes applications"
|
||||||
|
|
||||||
#: apps/member/templates/member/picture_update.html:35
|
#: apps/member/templates/member/picture_update.html:38
|
||||||
msgid "Nevermind"
|
msgid "Nevermind"
|
||||||
msgstr "Annuler"
|
msgstr "Annuler"
|
||||||
|
|
||||||
#: apps/member/templates/member/picture_update.html:36
|
#: apps/member/templates/member/picture_update.html:39
|
||||||
msgid "Crop and upload"
|
msgid "Crop and upload"
|
||||||
msgstr "Recadrer et envoyer"
|
msgstr "Recadrer et envoyer"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue