From 82924c999ae8417e1392321e83674959231ada04 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Sun, 6 Sep 2020 18:54:21 +0200 Subject: [PATCH 01/23] Add animated profile picture support --- apps/member/forms.py | 34 +++++++++++++++++++++++++--------- apps/member/views.py | 14 +++++++++++--- 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/apps/member/forms.py b/apps/member/forms.py index abefdf2c..04495159 100644 --- a/apps/member/forms.py +++ b/apps/member/forms.py @@ -3,7 +3,7 @@ import io -from PIL import Image +from PIL import Image, ImageSequence from django import forms from django.conf import settings from django.contrib.auth.forms import AuthenticationForm @@ -82,13 +82,19 @@ class ImageForm(forms.Form): height = forms.FloatField(widget=forms.HiddenInput()) def clean(self): - """Load image and crop""" + """ + Load image and crop + + In the future, when Pillow will support APNG we will be able to + simplify this code to save only PNG/APNG. + """ cleaned_data = super().clean() # Image size is limited by Django DATA_UPLOAD_MAX_MEMORY_SIZE image = cleaned_data.get('image') if image: # Let Pillow detect and load image + # If it is an animation, then there will be multiple frames try: im = Image.open(image) except OSError: @@ -96,20 +102,30 @@ class ImageForm(forms.Form): # but Pil is unable to load it raise forms.ValidationError(_('This image cannot be loaded.')) - # Crop image + # Crop each frame x = cleaned_data.get('x', 0) y = cleaned_data.get('y', 0) w = cleaned_data.get('width', 200) h = cleaned_data.get('height', 200) - im = im.crop((x, y, x + w, y + h)) - im = im.resize( - (settings.PIC_WIDTH, settings.PIC_RATIO * settings.PIC_WIDTH), - Image.ANTIALIAS, - ) + frames = [] + for frame in ImageSequence.Iterator(im): + frame = frame.crop((x, y, x + w, y + h)) + frame = frame.resize( + (settings.PIC_WIDTH, settings.PIC_RATIO * settings.PIC_WIDTH), + Image.ANTIALIAS, + ) + frames.append(frame) # Save + om = frames.pop(0) # Get first frame + om.info = im.info # Copy metadata image.file = io.BytesIO() - im.save(image.file, "PNG") + if len(frames) > 1: + # Save as GIF + om.save(image.file, "GIF", save_all=True, append_images=list(frames), loop=0) + else: + # Save as PNG + om.save(image.file, "PNG") return cleaned_data diff --git a/apps/member/views.py b/apps/member/views.py index 746f5c94..d0ae106a 100644 --- a/apps/member/views.py +++ b/apps/member/views.py @@ -271,9 +271,17 @@ class PictureUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin, Det def form_valid(self, form): """Save image to note""" - image_field = form.cleaned_data['image'] - image_field.name = "{}_pic.png".format(self.object.note.pk) - self.object.note.display_image = image_field + 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) + else: + image.name = "{}_pic.png".format(self.object.note.pk) + + # Save + self.object.note.display_image = image self.object.note.save() return super().form_valid(form) From 40a3405f4708ff3458daa3d3a5726a103df62271 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Sun, 6 Sep 2020 19:16:35 +0200 Subject: [PATCH 02/23] Fix missing spaces before comment --- apps/member/forms.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/member/forms.py b/apps/member/forms.py index 04495159..9fe8e74c 100644 --- a/apps/member/forms.py +++ b/apps/member/forms.py @@ -117,8 +117,8 @@ class ImageForm(forms.Form): frames.append(frame) # Save - om = frames.pop(0) # Get first frame - om.info = im.info # Copy metadata + om = frames.pop(0) # Get first frame + om.info = im.info # Copy metadata image.file = io.BytesIO() if len(frames) > 1: # Save as GIF From cc5996121b4360e07fcf650ee91198c8fa4dbaa5 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Sun, 6 Sep 2020 20:04:10 +0200 Subject: [PATCH 03/23] Change HTML localization --- note_kfet/templates/base.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/note_kfet/templates/base.html b/note_kfet/templates/base.html index 6d092367..a3b96d45 100644 --- a/note_kfet/templates/base.html +++ b/note_kfet/templates/base.html @@ -3,7 +3,8 @@ SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} - +{% get_current_language as LANGUAGE_CODE %}{% get_current_language_bidi as LANGUAGE_BIDI %} + From 1023c6c5022f364659082da114df2702b4ea3853 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sun, 6 Sep 2020 20:18:59 +0200 Subject: [PATCH 04/23] Use pre_delete signal insted of Model.delete() to prevent note balance issues when deleting a transaction (don't do it) in Django Admin --- apps/note/apps.py | 7 ++++++- apps/note/models/transactions.py | 8 -------- apps/note/signals.py | 8 ++++++++ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/apps/note/apps.py b/apps/note/apps.py index 4881e3b9..b3dc5a0f 100644 --- a/apps/note/apps.py +++ b/apps/note/apps.py @@ -3,7 +3,7 @@ from django.apps import AppConfig from django.conf import settings -from django.db.models.signals import post_save +from django.db.models.signals import post_save, pre_delete from django.utils.translation import gettext_lazy as _ from . import signals @@ -25,3 +25,8 @@ class NoteConfig(AppConfig): signals.save_club_note, sender='member.Club', ) + + pre_delete.connect( + signals.delete_transaction, + sender='note.transaction', + ) diff --git a/apps/note/models/transactions.py b/apps/note/models/transactions.py index a4f220bd..d10bf3a6 100644 --- a/apps/note/models/transactions.py +++ b/apps/note/models/transactions.py @@ -242,14 +242,6 @@ class Transaction(PolymorphicModel): self.destination._force_save = True self.destination.save() - def delete(self, **kwargs): - """ - Whenever we want to delete a transaction (caution with this), we ensure the transaction is invalid first. - """ - self.valid = False - self.save(**kwargs) - super().delete(**kwargs) - @property def total(self): return self.amount * self.quantity diff --git a/apps/note/signals.py b/apps/note/signals.py index 06bb480b..51ed92d8 100644 --- a/apps/note/signals.py +++ b/apps/note/signals.py @@ -24,3 +24,11 @@ def save_club_note(instance, raw, **_kwargs): from .models import NoteClub NoteClub.objects.get_or_create(club=instance) instance.note.save() + + +def delete_transaction(instance, **_kwargs): + """ + Whenever we want to delete a transaction (caution with this), we ensure the transaction is invalid first. + """ + instance.valid = False + instance.save() From c06354211b55877edd803bfbe5a2897e2638ccea Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Sun, 6 Sep 2020 20:21:31 +0200 Subject: [PATCH 05/23] Translate login page --- apps/member/forms.py | 2 +- locale/de/LC_MESSAGES/django.po | 162 ++++++++++++++++++-------------- locale/fr/LC_MESSAGES/django.po | 162 ++++++++++++++++++-------------- note_kfet/templates/base.html | 12 +-- 4 files changed, 187 insertions(+), 151 deletions(-) diff --git a/apps/member/forms.py b/apps/member/forms.py index 9fe8e74c..20de91b7 100644 --- a/apps/member/forms.py +++ b/apps/member/forms.py @@ -20,7 +20,7 @@ from .models import Profile, Club, Membership class CustomAuthenticationForm(AuthenticationForm): permission_mask = forms.ModelChoiceField( - label="Masque de permissions", + label=_("Permission mask"), queryset=PermissionMask.objects.order_by("rank"), empty_label=None, ) diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index b943b130..21c354a8 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-09-06 12:32+0200\n" +"POT-Creation-Date: 2020-09-06 20:16+0200\n" "PO-Revision-Date: 2020-09-03 23:47+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -53,7 +53,7 @@ msgstr "Sie dürfen höchstens 3 Leute zu dieser Veranstaltung einladen." #: apps/member/templates/member/includes/club_info.html:4 #: apps/member/templates/member/includes/profile_info.html:4 #: apps/note/models/notes.py:253 apps/note/models/transactions.py:26 -#: apps/note/models/transactions.py:46 apps/note/models/transactions.py:303 +#: apps/note/models/transactions.py:46 apps/note/models/transactions.py:302 #: apps/permission/models.py:329 #: apps/registration/templates/registration/future_profile_detail.html:16 #: apps/wei/models.py:66 apps/wei/models.py:118 @@ -244,13 +244,13 @@ msgstr "entfernen" msgid "Type" msgstr "Type" -#: apps/activity/tables.py:82 apps/member/forms.py:167 +#: apps/activity/tables.py:82 apps/member/forms.py:183 #: apps/registration/forms.py:81 apps/treasury/forms.py:129 #: apps/wei/forms/registration.py:96 msgid "Last name" msgstr "Nachname" -#: apps/activity/tables.py:84 apps/member/forms.py:172 +#: apps/activity/tables.py:84 apps/member/forms.py:188 #: apps/note/templates/note/transaction_form.html:134 #: apps/registration/forms.py:86 apps/treasury/forms.py:131 #: apps/wei/forms/registration.py:101 @@ -270,21 +270,21 @@ msgid "Guests list" msgstr "Gastliste" #: apps/activity/templates/activity/activity_entry.html:14 -#: apps/note/models/transactions.py:260 +#: apps/note/models/transactions.py:259 #: apps/note/templates/note/transaction_form.html:16 #: apps/note/templates/note/transaction_form.html:148 -#: note_kfet/templates/base.html:69 +#: note_kfet/templates/base.html:70 msgid "Transfer" msgstr "Überweisen" #: apps/activity/templates/activity/activity_entry.html:18 -#: apps/note/models/transactions.py:319 +#: apps/note/models/transactions.py:318 #: apps/note/templates/note/transaction_form.html:21 msgid "Credit" msgstr "Kredit" #: apps/activity/templates/activity/activity_entry.html:21 -#: apps/note/models/transactions.py:319 +#: apps/note/models/transactions.py:318 #: apps/note/templates/note/transaction_form.html:25 msgid "Debit" msgstr "Soll" @@ -368,7 +368,7 @@ msgstr "Einladen" msgid "Create new activity" msgstr "Neue Veranstaltung schaffen" -#: apps/activity/views.py:63 note_kfet/templates/base.html:87 +#: apps/activity/views.py:63 note_kfet/templates/base.html:88 msgid "Activities" msgstr "Veranstaltungen" @@ -480,6 +480,10 @@ msgstr "Preis" msgid "member" msgstr "Mitglied" +#: apps/member/forms.py:23 +msgid "Permission mask" +msgstr "Berechtigungsmaske" + #: apps/member/forms.py:45 msgid "Report frequency" msgstr "Bericht Frequenz" @@ -500,53 +504,53 @@ msgstr "Wählen sie ein Bild aus" msgid "Maximal size: 2MB" msgstr "Maximal Größe: 2MB" -#: apps/member/forms.py:97 +#: apps/member/forms.py:103 msgid "This image cannot be loaded." msgstr "Dieses Bild kann nicht geladen werden." -#: apps/member/forms.py:123 apps/member/views.py:98 +#: apps/member/forms.py:139 apps/member/views.py:98 #: apps/registration/forms.py:33 apps/registration/views.py:237 msgid "An alias with a similar name already exists." msgstr "Ein ähnliches Alias ist schon benutzt." -#: apps/member/forms.py:146 apps/registration/forms.py:61 +#: apps/member/forms.py:162 apps/registration/forms.py:61 msgid "Inscription paid by Société Générale" msgstr "Mitgliedschaft von der Société Générale bezahlt" -#: apps/member/forms.py:148 apps/registration/forms.py:63 +#: apps/member/forms.py:164 apps/registration/forms.py:63 msgid "Check this case is the Société Générale paid the inscription." msgstr "Die Société Générale die Mitgliedschaft bezahlt." -#: apps/member/forms.py:153 apps/registration/forms.py:68 +#: apps/member/forms.py:169 apps/registration/forms.py:68 #: apps/wei/forms/registration.py:83 msgid "Credit type" msgstr "Kredittype" -#: apps/member/forms.py:154 apps/registration/forms.py:69 +#: apps/member/forms.py:170 apps/registration/forms.py:69 #: apps/wei/forms/registration.py:84 msgid "No credit" msgstr "Kein Kredit" -#: apps/member/forms.py:156 +#: apps/member/forms.py:172 msgid "You can credit the note of the user." msgstr "Sie dûrfen diese Note kreditieren." -#: apps/member/forms.py:160 apps/registration/forms.py:74 +#: apps/member/forms.py:176 apps/registration/forms.py:74 #: apps/wei/forms/registration.py:89 msgid "Credit amount" msgstr "Kreditanzahl" -#: apps/member/forms.py:177 apps/note/templates/note/transaction_form.html:140 +#: apps/member/forms.py:193 apps/note/templates/note/transaction_form.html:140 #: apps/registration/forms.py:91 apps/treasury/forms.py:133 #: apps/wei/forms/registration.py:106 msgid "Bank" msgstr "Bank" -#: apps/member/forms.py:204 +#: apps/member/forms.py:220 msgid "User" msgstr "User" -#: apps/member/forms.py:218 +#: apps/member/forms.py:234 msgid "Roles" msgstr "Rollen" @@ -790,29 +794,29 @@ msgstr "Mitgliedschaft fängt an" msgid "membership ends on" msgstr "Mitgliedschaft endet am" -#: apps/member/models.py:375 +#: apps/member/models.py:420 #, python-brace-format msgid "The role {role} does not apply to the club {club}." msgstr "Die Rolle {role} ist nicht erlaubt für das Club {club}." -#: apps/member/models.py:384 apps/member/views.py:651 +#: apps/member/models.py:429 apps/member/views.py:628 msgid "User is already a member of the club" msgstr "User ist schon ein Mitglied dieser club" -#: apps/member/models.py:432 +#: apps/member/models.py:441 msgid "User is not a member of the parent club" msgstr "User ist noch nicht Mitglied des Urclubs" -#: apps/member/models.py:480 +#: apps/member/models.py:489 #, python-brace-format msgid "Membership of {user} for the club {club}" msgstr "Mitgliedschaft von {user} für das Club {club}" -#: apps/member/models.py:483 apps/note/models/transactions.py:360 +#: apps/member/models.py:492 apps/note/models/transactions.py:359 msgid "membership" msgstr "Mitgliedschaft" -#: apps/member/models.py:484 +#: apps/member/models.py:493 msgid "memberships" msgstr "Mitgliedschaften" @@ -907,7 +911,7 @@ msgstr "" #: apps/member/templates/member/club_alias.html:10 #: apps/member/templates/member/profile_alias.html:10 apps/member/views.py:236 -#: apps/member/views.py:425 +#: apps/member/views.py:433 msgid "Note aliases" msgstr "Note Aliases" @@ -1058,31 +1062,31 @@ msgstr "User finden" msgid "Update note picture" msgstr "Notebild ändern" -#: apps/member/views.py:293 +#: apps/member/views.py:301 msgid "Manage auth token" msgstr "Auth token bearbeiten" -#: apps/member/views.py:320 +#: apps/member/views.py:328 msgid "Create new club" msgstr "Neue Club" -#: apps/member/views.py:339 +#: apps/member/views.py:347 msgid "Search club" msgstr "Club finden" -#: apps/member/views.py:372 +#: apps/member/views.py:380 msgid "Club detail" msgstr "Club Details" -#: apps/member/views.py:448 +#: apps/member/views.py:456 msgid "Update club" msgstr "Club bearbeiten" -#: apps/member/views.py:482 +#: apps/member/views.py:490 msgid "Add new member to the club" msgstr "Neue Mitglieder" -#: apps/member/views.py:642 apps/wei/views.py:922 +#: apps/member/views.py:619 apps/wei/views.py:922 msgid "" "This user don't have enough money to join this club, and can't have a " "negative balance." @@ -1090,25 +1094,25 @@ msgstr "" "Diese User hat nicht genug Geld um Mitglied zu werden, und darf nich im Rot " "sein." -#: apps/member/views.py:655 +#: apps/member/views.py:632 msgid "The membership must start after {:%m-%d-%Y}." msgstr "Die Mitgliedschaft muss nach {:%m-%d-Y} anfängen." -#: apps/member/views.py:660 +#: apps/member/views.py:637 msgid "The membership must begin before {:%m-%d-%Y}." msgstr "Die Mitgliedschaft muss vor {:%m-%d-Y} anfängen." -#: apps/member/views.py:676 apps/member/views.py:678 apps/member/views.py:680 +#: apps/member/views.py:644 apps/member/views.py:646 apps/member/views.py:648 #: apps/registration/views.py:287 apps/registration/views.py:289 #: apps/registration/views.py:291 apps/wei/views.py:927 apps/wei/views.py:931 msgid "This field is required." msgstr "Dies ist ein Pflichtfeld." -#: apps/member/views.py:753 +#: apps/member/views.py:783 msgid "Manage roles of an user in the club" msgstr "Rollen in diesen Club bearbeiten" -#: apps/member/views.py:778 +#: apps/member/views.py:808 msgid "Members of the club" msgstr "Mitlglieder dieses Club" @@ -1355,34 +1359,34 @@ msgstr "" "Die Notenguthaben müssen zwischen - 92 233 720 368 547 758,08 € und 92 233 " "720 368 547 758,07 € liegen." -#: apps/note/models/transactions.py:280 +#: apps/note/models/transactions.py:279 msgid "" "The destination of this transaction must equal to the destination of the " "template." msgstr "" "Der Empfänger dieser Transaktion muss dem Empfänger der Vorlage entsprechen." -#: apps/note/models/transactions.py:289 +#: apps/note/models/transactions.py:288 msgid "Template" msgstr "Vorlage" -#: apps/note/models/transactions.py:292 +#: apps/note/models/transactions.py:291 msgid "recurrent transaction" msgstr "wiederkehrende Transaktion" -#: apps/note/models/transactions.py:293 +#: apps/note/models/transactions.py:292 msgid "recurrent transactions" msgstr "wiederkehrende Transaktionen" -#: apps/note/models/transactions.py:308 +#: apps/note/models/transactions.py:307 msgid "first_name" msgstr "Vorname" -#: apps/note/models/transactions.py:313 +#: apps/note/models/transactions.py:312 msgid "bank" msgstr "Bank" -#: apps/note/models/transactions.py:330 +#: apps/note/models/transactions.py:329 msgid "" "A special transaction is only possible between a Note associated to a " "payment method and a User or a Club" @@ -1390,19 +1394,19 @@ msgstr "" "Eine Sondertransaktion ist nur zwischen einer Note, die einer " "Zahlungsmethode zugeordnet ist, und einem User oder einem Club möglich" -#: apps/note/models/transactions.py:338 +#: apps/note/models/transactions.py:337 msgid "Special transaction" msgstr "Sondertransaktion" -#: apps/note/models/transactions.py:339 +#: apps/note/models/transactions.py:338 msgid "Special transactions" msgstr "Sondertranskationen" -#: apps/note/models/transactions.py:355 +#: apps/note/models/transactions.py:354 msgid "membership transaction" msgstr "Mitgliedschafttransaktion" -#: apps/note/models/transactions.py:356 apps/treasury/models.py:273 +#: apps/note/models/transactions.py:355 apps/treasury/models.py:273 msgid "membership transactions" msgstr "Mitgliedschaftttransaktionen" @@ -1574,7 +1578,7 @@ msgstr "Tatsen finden" msgid "Update button" msgstr "Tatse bearbeiten" -#: apps/note/views.py:151 note_kfet/templates/base.html:63 +#: apps/note/views.py:151 note_kfet/templates/base.html:64 msgid "Consumptions" msgstr "Verbräuche" @@ -1752,7 +1756,7 @@ msgstr "" "diesen Parametern zu erstellen. Bitte korrigieren Sie Ihre Daten und " "versuchen Sie es erneut." -#: apps/permission/views.py:96 note_kfet/templates/base.html:105 +#: apps/permission/views.py:96 note_kfet/templates/base.html:106 msgid "Rights" msgstr "Rechten" @@ -1946,7 +1950,7 @@ msgstr "" msgid "Invalidate pre-registration" msgstr "Ungültige Vorregistrierung" -#: apps/treasury/apps.py:12 note_kfet/templates/base.html:93 +#: apps/treasury/apps.py:12 note_kfet/templates/base.html:94 msgid "Treasury" msgstr "Quaestor" @@ -2338,7 +2342,7 @@ msgstr "Krediten von der Société générale handeln" #: apps/wei/apps.py:10 apps/wei/models.py:49 apps/wei/models.py:50 #: apps/wei/models.py:61 apps/wei/models.py:167 -#: note_kfet/templates/base.html:99 +#: note_kfet/templates/base.html:100 msgid "WEI" msgstr "WEI" @@ -2942,23 +2946,46 @@ msgstr "" msgid "Reset" msgstr "Reset" -#: note_kfet/templates/base.html:13 +#: note_kfet/templates/base.html:14 msgid "The ENS Paris-Saclay BDE note." msgstr "Die BDE ENS-Paris-Saclay Note." -#: note_kfet/templates/base.html:75 +#: note_kfet/templates/base.html:76 msgid "Users" msgstr "Users" -#: note_kfet/templates/base.html:81 +#: note_kfet/templates/base.html:82 msgid "Clubs" msgstr "Clubs" -#: note_kfet/templates/base.html:110 +#: note_kfet/templates/base.html:111 msgid "Admin" msgstr "Admin" -#: note_kfet/templates/base.html:154 +#: note_kfet/templates/base.html:125 +msgid "My account" +msgstr "Mein Konto" + +#: note_kfet/templates/base.html:128 +msgid "Log out" +msgstr "AAbmelden" + +#: note_kfet/templates/base.html:136 +#: note_kfet/templates/registration/signup.html:6 +#: note_kfet/templates/registration/signup.html:11 +#: note_kfet/templates/registration/signup.html:27 +msgid "Sign up" +msgstr "Registrieren" + +#: note_kfet/templates/base.html:143 +#: note_kfet/templates/registration/login.html:6 +#: note_kfet/templates/registration/login.html:15 +#: note_kfet/templates/registration/login.html:38 +#: note_kfet/templates/registration/password_reset_complete.html:15 +msgid "Log in" +msgstr "Anmelden" + +#: note_kfet/templates/base.html:155 msgid "" "Your e-mail address is not validated. Please check your mail inbox and click " "on the validation link." @@ -2966,6 +2993,10 @@ msgstr "" "Ihre E-Mail-Adresse ist nicht validiert. Bitte überprüfen Sie Ihren " "Posteingang und klicken Sie auf den Validierungslink." +#: note_kfet/templates/base.html:172 +msgid "Contact us" +msgstr "Kontakt" + #: note_kfet/templates/base_search.html:15 msgid "Search by attribute such as name…" msgstr "Suche nach Attributen wie Name…" @@ -2998,13 +3029,6 @@ msgstr "" msgid "Log in again" msgstr "Nochmal anmelden" -#: note_kfet/templates/registration/login.html:6 -#: note_kfet/templates/registration/login.html:15 -#: note_kfet/templates/registration/login.html:38 -#: note_kfet/templates/registration/password_reset_complete.html:15 -msgid "Log in" -msgstr "Anmelden" - #: note_kfet/templates/registration/login.html:20 #, python-format msgid "" @@ -3096,12 +3120,6 @@ msgstr "" msgid "Reset my password" msgstr "Mein Passwort zurücksetzen" -#: note_kfet/templates/registration/signup.html:6 -#: note_kfet/templates/registration/signup.html:11 -#: note_kfet/templates/registration/signup.html:27 -msgid "Sign up" -msgstr "Registrieren" - #: note_kfet/templates/registration/signup.html:15 msgid "" "If you already signed up, your registration is taken into account. The BDE " diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 1b715643..353e342a 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-09-06 12:32+0200\n" +"POT-Creation-Date: 2020-09-06 20:16+0200\n" "PO-Revision-Date: 2020-09-02 23:18+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -53,7 +53,7 @@ msgstr "Vous ne pouvez pas inviter plus de 3 personnes à cette activité." #: apps/member/templates/member/includes/club_info.html:4 #: apps/member/templates/member/includes/profile_info.html:4 #: apps/note/models/notes.py:253 apps/note/models/transactions.py:26 -#: apps/note/models/transactions.py:46 apps/note/models/transactions.py:303 +#: apps/note/models/transactions.py:46 apps/note/models/transactions.py:302 #: apps/permission/models.py:329 #: apps/registration/templates/registration/future_profile_detail.html:16 #: apps/wei/models.py:66 apps/wei/models.py:118 @@ -244,13 +244,13 @@ msgstr "supprimer" msgid "Type" msgstr "Type" -#: apps/activity/tables.py:82 apps/member/forms.py:167 +#: apps/activity/tables.py:82 apps/member/forms.py:183 #: apps/registration/forms.py:81 apps/treasury/forms.py:129 #: apps/wei/forms/registration.py:96 msgid "Last name" msgstr "Nom de famille" -#: apps/activity/tables.py:84 apps/member/forms.py:172 +#: apps/activity/tables.py:84 apps/member/forms.py:188 #: apps/note/templates/note/transaction_form.html:134 #: apps/registration/forms.py:86 apps/treasury/forms.py:131 #: apps/wei/forms/registration.py:101 @@ -270,21 +270,21 @@ msgid "Guests list" msgstr "Liste des invités" #: apps/activity/templates/activity/activity_entry.html:14 -#: apps/note/models/transactions.py:260 +#: apps/note/models/transactions.py:259 #: apps/note/templates/note/transaction_form.html:16 #: apps/note/templates/note/transaction_form.html:148 -#: note_kfet/templates/base.html:69 +#: note_kfet/templates/base.html:70 msgid "Transfer" msgstr "Virement" #: apps/activity/templates/activity/activity_entry.html:18 -#: apps/note/models/transactions.py:319 +#: apps/note/models/transactions.py:318 #: apps/note/templates/note/transaction_form.html:21 msgid "Credit" msgstr "Crédit" #: apps/activity/templates/activity/activity_entry.html:21 -#: apps/note/models/transactions.py:319 +#: apps/note/models/transactions.py:318 #: apps/note/templates/note/transaction_form.html:25 msgid "Debit" msgstr "Débit" @@ -368,7 +368,7 @@ msgstr "Inviter" msgid "Create new activity" msgstr "Créer une nouvelle activité" -#: apps/activity/views.py:63 note_kfet/templates/base.html:87 +#: apps/activity/views.py:63 note_kfet/templates/base.html:88 msgid "Activities" msgstr "Activités" @@ -482,6 +482,10 @@ msgstr "cotisation" msgid "member" msgstr "adhérent" +#: apps/member/forms.py:23 +msgid "Permission mask" +msgstr "Masque de permissions" + #: apps/member/forms.py:45 msgid "Report frequency" msgstr "Fréquence des rapports (en jours)" @@ -502,53 +506,53 @@ msgstr "choisissez une image" msgid "Maximal size: 2MB" msgstr "Taille maximale : 2 Mo" -#: apps/member/forms.py:97 +#: apps/member/forms.py:103 msgid "This image cannot be loaded." msgstr "Cette image ne peut pas être chargée." -#: apps/member/forms.py:123 apps/member/views.py:98 +#: apps/member/forms.py:139 apps/member/views.py:98 #: apps/registration/forms.py:33 apps/registration/views.py:237 msgid "An alias with a similar name already exists." msgstr "Un alias avec un nom similaire existe déjà." -#: apps/member/forms.py:146 apps/registration/forms.py:61 +#: apps/member/forms.py:162 apps/registration/forms.py:61 msgid "Inscription paid by Société Générale" msgstr "Inscription payée par la Société générale" -#: apps/member/forms.py:148 apps/registration/forms.py:63 +#: apps/member/forms.py:164 apps/registration/forms.py:63 msgid "Check this case is 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:153 apps/registration/forms.py:68 +#: apps/member/forms.py:169 apps/registration/forms.py:68 #: apps/wei/forms/registration.py:83 msgid "Credit type" msgstr "Type de rechargement" -#: apps/member/forms.py:154 apps/registration/forms.py:69 +#: apps/member/forms.py:170 apps/registration/forms.py:69 #: apps/wei/forms/registration.py:84 msgid "No credit" msgstr "Pas de rechargement" -#: apps/member/forms.py:156 +#: apps/member/forms.py:172 msgid "You can credit the note of the user." msgstr "Vous pouvez créditer la note de l'utisateur avant l'adhésion." -#: apps/member/forms.py:160 apps/registration/forms.py:74 +#: apps/member/forms.py:176 apps/registration/forms.py:74 #: apps/wei/forms/registration.py:89 msgid "Credit amount" msgstr "Montant à créditer" -#: apps/member/forms.py:177 apps/note/templates/note/transaction_form.html:140 +#: apps/member/forms.py:193 apps/note/templates/note/transaction_form.html:140 #: apps/registration/forms.py:91 apps/treasury/forms.py:133 #: apps/wei/forms/registration.py:106 msgid "Bank" msgstr "Banque" -#: apps/member/forms.py:204 +#: apps/member/forms.py:220 msgid "User" msgstr "Utilisateur" -#: apps/member/forms.py:218 +#: apps/member/forms.py:234 msgid "Roles" msgstr "Rôles" @@ -792,29 +796,29 @@ msgstr "l'adhésion commence le" msgid "membership ends on" msgstr "l'adhésion finit le" -#: apps/member/models.py:375 +#: apps/member/models.py:420 #, python-brace-format msgid "The role {role} does not apply to the club {club}." msgstr "Le rôle {role} ne s'applique pas au club {club}." -#: apps/member/models.py:384 apps/member/views.py:651 +#: apps/member/models.py:429 apps/member/views.py:628 msgid "User is already a member of the club" msgstr "L'utilisateur est déjà membre du club" -#: apps/member/models.py:432 +#: apps/member/models.py:441 msgid "User is not a member of the parent club" msgstr "L'utilisateur n'est pas membre du club parent" -#: apps/member/models.py:480 +#: apps/member/models.py:489 #, python-brace-format msgid "Membership of {user} for the club {club}" msgstr "Adhésion de {user} pour le club {club}" -#: apps/member/models.py:483 apps/note/models/transactions.py:360 +#: apps/member/models.py:492 apps/note/models/transactions.py:359 msgid "membership" msgstr "adhésion" -#: apps/member/models.py:484 +#: apps/member/models.py:493 msgid "memberships" msgstr "adhésions" @@ -909,7 +913,7 @@ msgstr "" #: apps/member/templates/member/club_alias.html:10 #: apps/member/templates/member/profile_alias.html:10 apps/member/views.py:236 -#: apps/member/views.py:425 +#: apps/member/views.py:433 msgid "Note aliases" msgstr "Alias de la note" @@ -1060,31 +1064,31 @@ msgstr "Chercher un utilisateur" msgid "Update note picture" msgstr "Modifier la photo de la note" -#: apps/member/views.py:293 +#: apps/member/views.py:301 msgid "Manage auth token" msgstr "Gérer les jetons d'authentification" -#: apps/member/views.py:320 +#: apps/member/views.py:328 msgid "Create new club" msgstr "Créer un nouveau club" -#: apps/member/views.py:339 +#: apps/member/views.py:347 msgid "Search club" msgstr "Chercher un club" -#: apps/member/views.py:372 +#: apps/member/views.py:380 msgid "Club detail" msgstr "Détails du club" -#: apps/member/views.py:448 +#: apps/member/views.py:456 msgid "Update club" msgstr "Modifier le club" -#: apps/member/views.py:482 +#: apps/member/views.py:490 msgid "Add new member to the club" msgstr "Ajouter un nouveau membre au club" -#: apps/member/views.py:642 apps/wei/views.py:922 +#: apps/member/views.py:619 apps/wei/views.py:922 msgid "" "This user don't have enough money to join this club, and can't have a " "negative balance." @@ -1092,25 +1096,25 @@ msgstr "" "Cet utilisateur n'a pas assez d'argent pour rejoindre ce club et ne peut pas " "avoir un solde négatif." -#: apps/member/views.py:655 +#: apps/member/views.py:632 msgid "The membership must start after {:%m-%d-%Y}." msgstr "L'adhésion doit commencer après le {:%d/%m/%Y}." -#: apps/member/views.py:660 +#: apps/member/views.py:637 msgid "The membership must begin before {:%m-%d-%Y}." msgstr "L'adhésion doit commencer avant le {:%d/%m/%Y}." -#: apps/member/views.py:676 apps/member/views.py:678 apps/member/views.py:680 +#: apps/member/views.py:644 apps/member/views.py:646 apps/member/views.py:648 #: apps/registration/views.py:287 apps/registration/views.py:289 #: apps/registration/views.py:291 apps/wei/views.py:927 apps/wei/views.py:931 msgid "This field is required." msgstr "Ce champ est requis." -#: apps/member/views.py:753 +#: apps/member/views.py:783 msgid "Manage roles of an user in the club" msgstr "Gérer les rôles d'un utilisateur dans le club" -#: apps/member/views.py:778 +#: apps/member/views.py:808 msgid "Members of the club" msgstr "Membres du club" @@ -1359,7 +1363,7 @@ msgstr "" "€ et 92 233 720 368 547 758.07 €. Ne cherchez pas à capitaliser l'argent du " "BDE." -#: apps/note/models/transactions.py:280 +#: apps/note/models/transactions.py:279 msgid "" "The destination of this transaction must equal to the destination of the " "template." @@ -1367,27 +1371,27 @@ msgstr "" "Le destinataire de cette transaction doit être identique à celui du bouton " "utilisé." -#: apps/note/models/transactions.py:289 +#: apps/note/models/transactions.py:288 msgid "Template" msgstr "Bouton" -#: apps/note/models/transactions.py:292 +#: apps/note/models/transactions.py:291 msgid "recurrent transaction" msgstr "transaction issue de bouton" -#: apps/note/models/transactions.py:293 +#: apps/note/models/transactions.py:292 msgid "recurrent transactions" msgstr "transactions issues de boutons" -#: apps/note/models/transactions.py:308 +#: apps/note/models/transactions.py:307 msgid "first_name" msgstr "prénom" -#: apps/note/models/transactions.py:313 +#: apps/note/models/transactions.py:312 msgid "bank" msgstr "banque" -#: apps/note/models/transactions.py:330 +#: apps/note/models/transactions.py:329 msgid "" "A special transaction is only possible between a Note associated to a " "payment method and a User or a Club" @@ -1395,19 +1399,19 @@ msgstr "" "Une transaction spéciale n'est possible que entre une note associée à un " "mode de paiement et un utilisateur ou un club" -#: apps/note/models/transactions.py:338 +#: apps/note/models/transactions.py:337 msgid "Special transaction" msgstr "Transaction de crédit/retrait" -#: apps/note/models/transactions.py:339 +#: apps/note/models/transactions.py:338 msgid "Special transactions" msgstr "Transactions de crédit/retrait" -#: apps/note/models/transactions.py:355 +#: apps/note/models/transactions.py:354 msgid "membership transaction" msgstr "transaction d'adhésion" -#: apps/note/models/transactions.py:356 apps/treasury/models.py:273 +#: apps/note/models/transactions.py:355 apps/treasury/models.py:273 msgid "membership transactions" msgstr "transactions d'adhésion" @@ -1579,7 +1583,7 @@ msgstr "Chercher un bouton" msgid "Update button" msgstr "Modifier le bouton" -#: apps/note/views.py:151 note_kfet/templates/base.html:63 +#: apps/note/views.py:151 note_kfet/templates/base.html:64 msgid "Consumptions" msgstr "Consommations" @@ -1758,7 +1762,7 @@ msgstr "" "Vous n'avez pas la permission d'ajouter une instance du modèle « {model} » " "avec ces paramètres. Merci de les corriger et de réessayer." -#: apps/permission/views.py:96 note_kfet/templates/base.html:105 +#: apps/permission/views.py:96 note_kfet/templates/base.html:106 msgid "Rights" msgstr "Droits" @@ -1950,7 +1954,7 @@ msgstr "" msgid "Invalidate pre-registration" msgstr "Invalider l'inscription" -#: apps/treasury/apps.py:12 note_kfet/templates/base.html:93 +#: apps/treasury/apps.py:12 note_kfet/templates/base.html:94 msgid "Treasury" msgstr "Trésorerie" @@ -2340,7 +2344,7 @@ msgstr "Gérer les crédits de la Société générale" #: apps/wei/apps.py:10 apps/wei/models.py:49 apps/wei/models.py:50 #: apps/wei/models.py:61 apps/wei/models.py:167 -#: note_kfet/templates/base.html:99 +#: note_kfet/templates/base.html:100 msgid "WEI" msgstr "WEI" @@ -2944,23 +2948,46 @@ msgstr "" msgid "Reset" msgstr "Réinitialiser" -#: note_kfet/templates/base.html:13 +#: note_kfet/templates/base.html:14 msgid "The ENS Paris-Saclay BDE note." msgstr "La note du BDE de l'ENS Paris-Saclay." -#: note_kfet/templates/base.html:75 +#: note_kfet/templates/base.html:76 msgid "Users" msgstr "Utilisateurs" -#: note_kfet/templates/base.html:81 +#: note_kfet/templates/base.html:82 msgid "Clubs" msgstr "Clubs" -#: note_kfet/templates/base.html:110 +#: note_kfet/templates/base.html:111 msgid "Admin" msgstr "Admin" -#: note_kfet/templates/base.html:154 +#: note_kfet/templates/base.html:125 +msgid "My account" +msgstr "Mon compte" + +#: note_kfet/templates/base.html:128 +msgid "Log out" +msgstr "Se déconnecter" + +#: note_kfet/templates/base.html:136 +#: note_kfet/templates/registration/signup.html:6 +#: note_kfet/templates/registration/signup.html:11 +#: note_kfet/templates/registration/signup.html:27 +msgid "Sign up" +msgstr "Inscription" + +#: note_kfet/templates/base.html:143 +#: note_kfet/templates/registration/login.html:6 +#: note_kfet/templates/registration/login.html:15 +#: note_kfet/templates/registration/login.html:38 +#: note_kfet/templates/registration/password_reset_complete.html:15 +msgid "Log in" +msgstr "Se connecter" + +#: note_kfet/templates/base.html:155 msgid "" "Your e-mail address is not validated. Please check your mail inbox and click " "on the validation link." @@ -2968,6 +2995,10 @@ msgstr "" "Votre adresse e-mail n'est pas validée. Merci de vérifier votre boîte mail " "et de cliquer sur le lien de validation." +#: note_kfet/templates/base.html:172 +msgid "Contact us" +msgstr "Nous contacter" + #: note_kfet/templates/base_search.html:15 msgid "Search by attribute such as name…" msgstr "Chercher par un attribut tel que le nom …" @@ -2999,13 +3030,6 @@ msgstr "Merci d'avoir utilisé la Note Kfet." msgid "Log in again" msgstr "Se connecter à nouveau" -#: note_kfet/templates/registration/login.html:6 -#: note_kfet/templates/registration/login.html:15 -#: note_kfet/templates/registration/login.html:38 -#: note_kfet/templates/registration/password_reset_complete.html:15 -msgid "Log in" -msgstr "Se connecter" - #: note_kfet/templates/registration/login.html:20 #, python-format msgid "" @@ -3097,12 +3121,6 @@ msgstr "" msgid "Reset my password" msgstr "Réinitialiser mon mot de passe" -#: note_kfet/templates/registration/signup.html:6 -#: note_kfet/templates/registration/signup.html:11 -#: note_kfet/templates/registration/signup.html:27 -msgid "Sign up" -msgstr "Inscription" - #: note_kfet/templates/registration/signup.html:15 msgid "" "If you already signed up, your registration is taken into account. The BDE " diff --git a/note_kfet/templates/base.html b/note_kfet/templates/base.html index a3b96d45..7cd8fbc8 100644 --- a/note_kfet/templates/base.html +++ b/note_kfet/templates/base.html @@ -38,7 +38,7 @@ SPDX-License-Identifier: GPL-3.0-or-later - {# Si un formulaire requiert des données supplémentaires (notamment JS), les données sont chargées #} + {# If extra ressources are needed for a form, load here #} {% if form.media %} {{ form.media }} {% endif %} @@ -122,10 +122,10 @@ SPDX-License-Identifier: GPL-3.0-or-later @@ -133,14 +133,14 @@ SPDX-License-Identifier: GPL-3.0-or-later {% if request.path != "/registration/signup/" %} {% endif %} {% if request.path != "/accounts/login/" %} {% endif %} @@ -169,7 +169,7 @@ SPDX-License-Identifier: GPL-3.0-or-later class="form-inline"> Nous contacter — + class="text-muted">{% trans "Contact us" %} — {% csrf_token %} diff --git a/apps/permission/tests/test_permission_queries.py b/apps/permission/tests/test_permission_queries.py index 4d73ae11..fdd530a5 100644 --- a/apps/permission/tests/test_permission_queries.py +++ b/apps/permission/tests/test_permission_queries.py @@ -78,7 +78,6 @@ class PermissionQueryTestCase(TestCase): query = instanced.query model = perm.model.model_class() model.objects.filter(query).all() - # print("Good query for permission", perm) except (FieldError, AttributeError, ValueError, TypeError, JSONDecodeError): print("Query error for permission", perm) print("Query:", perm.query) diff --git a/note_kfet/static/js/transfer.js b/note_kfet/static/js/transfer.js index db9cf9ac..94190da5 100644 --- a/note_kfet/static/js/transfer.js +++ b/note_kfet/static/js/transfer.js @@ -183,7 +183,10 @@ $(document).ready(function () { if (location.hash) { $('#type_' + location.hash.substr(1)).click() } else { type_transfer.click() } - $('#source_me').click(function () { + $('#source_me').click(function (event) { + // Prevent TurboLinks + event.preventDefault(); + if (LOCK) { return } // Shortcut to set the current user as the only emitter From 27aa2e9da8c6293dde5130e132764333cca4636b Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Sun, 6 Sep 2020 21:41:33 +0200 Subject: [PATCH 11/23] JQuery is unable to cancel Turbolinks --- apps/note/templates/note/transaction_form.html | 2 +- note_kfet/static/js/transfer.js | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/apps/note/templates/note/transaction_form.html b/apps/note/templates/note/transaction_form.html index 3f58b793..f5ff0b73 100644 --- a/apps/note/templates/note/transaction_form.html +++ b/apps/note/templates/note/transaction_form.html @@ -65,7 +65,7 @@ SPDX-License-Identifier: GPL-2.0-or-later diff --git a/note_kfet/static/js/transfer.js b/note_kfet/static/js/transfer.js index 94190da5..db9cf9ac 100644 --- a/note_kfet/static/js/transfer.js +++ b/note_kfet/static/js/transfer.js @@ -183,10 +183,7 @@ $(document).ready(function () { if (location.hash) { $('#type_' + location.hash.substr(1)).click() } else { type_transfer.click() } - $('#source_me').click(function (event) { - // Prevent TurboLinks - event.preventDefault(); - + $('#source_me').click(function () { if (LOCK) { return } // Shortcut to set the current user as the only emitter From 4452d112e3bd7a0aba9e028505c171e11a302907 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Sun, 6 Sep 2020 21:50:06 +0200 Subject: [PATCH 12/23] Navbar should expand only on large screen --- note_kfet/templates/base.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/note_kfet/templates/base.html b/note_kfet/templates/base.html index 7cd8fbc8..f65fe87c 100644 --- a/note_kfet/templates/base.html +++ b/note_kfet/templates/base.html @@ -47,7 +47,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
-