mirror of
				https://gitlab.crans.org/bde/nk20
				synced 2025-10-31 07:49:57 +01:00 
			
		
		
		
	Merge branch 'remove_picture' into 'main'
Allow you to delete the profile picture See merge request bde/nk20!250
This commit is contained in:
		| @@ -138,6 +138,9 @@ class ImageForm(forms.Form): | ||||
|  | ||||
|         return cleaned_data | ||||
|  | ||||
|     def is_valid(self): | ||||
|         return super().is_valid() or super().clean().get('image') is None | ||||
|  | ||||
|  | ||||
| class ClubForm(forms.ModelForm): | ||||
|     def clean(self): | ||||
|   | ||||
| @@ -14,6 +14,9 @@ SPDX-License-Identifier: GPL-3.0-or-later | ||||
|       <form method="post" enctype="multipart/form-data" id="formUpload"> | ||||
|         {% csrf_token %} | ||||
|         {{ form |crispy }} | ||||
|         {% if user.note.display_image != "pic/default.png" %} | ||||
|           <input type="submit" class="btn btn-primary" value="{% trans "Remove" %}"> | ||||
|         {% endif %} | ||||
|       </form> | ||||
|     </div> | ||||
|     <!-- MODAL TO CROP THE IMAGE --> | ||||
|   | ||||
| @@ -326,12 +326,15 @@ class PictureUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin, Det | ||||
|         """Save image to note""" | ||||
|         image = form.cleaned_data['image'] | ||||
|  | ||||
|         # Rename as a PNG or GIF | ||||
|         extension = image.name.split(".")[-1] | ||||
|         if extension == "gif": | ||||
|             image.name = "{}_pic.gif".format(self.object.note.pk) | ||||
|         if image is None: | ||||
|             image = "pic/default.png" | ||||
|         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 | ||||
|         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." | ||||
|  | ||||
| #: apps/activity/tables.py:43 apps/treasury/tables.py:107 | ||||
| #: apps/member/templates/member/picture_update.html:18 | ||||
| msgid "Remove" | ||||
| msgstr "Supprimer" | ||||
|  | ||||
| @@ -262,13 +263,13 @@ msgstr "supprimer" | ||||
| msgid "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/wei/forms/registration.py:104 | ||||
| msgid "Last name" | ||||
| 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/registration/forms.py:97 apps/treasury/forms.py:133 | ||||
| #: apps/wei/forms/registration.py:109 | ||||
| @@ -567,25 +568,25 @@ msgstr "Cette image ne peut pas être chargée." | ||||
| msgid "An alias with a similar name already exists." | ||||
| 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" | ||||
| 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." | ||||
| 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 | ||||
| msgid "Credit type" | ||||
| 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 | ||||
| msgid "No credit" | ||||
| msgstr "Pas de rechargement" | ||||
|  | ||||
| #: apps/member/forms.py:182 | ||||
| #: apps/member/forms.py:185 | ||||
| msgid "You can credit the note of the user." | ||||
| 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" | ||||
| 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/wei/forms/registration.py:114 | ||||
| msgid "Bank" | ||||
| msgstr "Banque" | ||||
|  | ||||
| #: apps/member/forms.py:230 | ||||
| #: apps/member/forms.py:233 | ||||
| msgid "User" | ||||
| msgstr "Utilisateur·ice" | ||||
|  | ||||
| #: apps/member/forms.py:244 | ||||
| #: apps/member/forms.py:247 | ||||
| msgid "Roles" | ||||
| msgstr "Rôles" | ||||
|  | ||||
| @@ -1157,11 +1158,11 @@ msgstr "Introspection :" | ||||
| msgid "Show my applications" | ||||
| msgstr "Voir mes applications" | ||||
|  | ||||
| #: apps/member/templates/member/picture_update.html:35 | ||||
| #: apps/member/templates/member/picture_update.html:38 | ||||
| msgid "Nevermind" | ||||
| msgstr "Annuler" | ||||
|  | ||||
| #: apps/member/templates/member/picture_update.html:36 | ||||
| #: apps/member/templates/member/picture_update.html:39 | ||||
| msgid "Crop and upload" | ||||
| msgstr "Recadrer et envoyer" | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user