From 535c493bc7434a36f8f26b355535931cf028440c Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Wed, 1 Apr 2020 04:20:47 +0200 Subject: [PATCH] Fix some issues --- apps/member/models.py | 9 ++++++--- locale/de/LC_MESSAGES/django.po | 11 ++++++++--- locale/fr/LC_MESSAGES/django.po | 15 +++++++-------- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/apps/member/models.py b/apps/member/models.py index 47807976..be4fe7e9 100644 --- a/apps/member/models.py +++ b/apps/member/models.py @@ -5,7 +5,7 @@ import datetime from django.conf import settings from django.contrib.auth.models import User -from django.core.exceptions import ValidationError, PermissionDenied +from django.core.exceptions import ValidationError from django.db import models from django.urls import reverse, reverse_lazy from django.utils.translation import gettext_lazy as _ @@ -246,7 +246,7 @@ class Membership(models.Model): self.make_transaction() def make_transaction(self): - if self.transaction is not None or not self.fee: + if not self.fee or MembershipTransaction.objects.filter(membership=self).exists(): return if self.fee: @@ -256,11 +256,14 @@ class Membership(models.Model): destination=self.club.note, quantity=1, amount=self.fee, - reason="Adhésion", + reason="Adhésion " + self.club.name, ) transaction._force_save = True transaction.save(force_insert=True) + def __str__(self): + return _("Membership of {user} for the club {club}").format(user=self.user.username, club=self.club.name, ) + class Meta: verbose_name = _('membership') verbose_name_plural = _('memberships') diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index 9348a93a..39f5818c 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-04-01 04:00+0200\n" +"POT-Creation-Date: 2020-04-01 04:12+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -362,10 +362,15 @@ msgid "User is already a member of the club" msgstr "" #: apps/member/models.py:265 +#, python-brace-format +msgid "Membership of {user} for the club {club}" +msgstr "" + +#: apps/member/models.py:268 msgid "membership" msgstr "" -#: apps/member/models.py:266 +#: apps/member/models.py:269 msgid "memberships" msgstr "" @@ -382,7 +387,7 @@ msgid "The membership must start after {:%m-%d-%Y}." msgstr "" #: apps/member/views.py:383 apps/member/views.py:415 -msgid "The membership must start before {:%m-%d-%Y}." +msgid "The membership must begin before {:%m-%d-%Y}." msgstr "" #: apps/note/admin.py:120 apps/note/models/transactions.py:94 diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index aeb565cc..24f7bf8a 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-04-01 04:00+0200\n" +"POT-Creation-Date: 2020-04-01 04:12+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -362,10 +362,15 @@ msgid "User is already a member of the club" msgstr "L'utilisateur est déjà membre du club" #: apps/member/models.py:265 +#, python-brace-format +msgid "Membership of {user} for the club {club}" +msgstr "Adhésion de {user} pour le club {club}" + +#: apps/member/models.py:268 msgid "membership" msgstr "adhésion" -#: apps/member/models.py:266 +#: apps/member/models.py:269 msgid "memberships" msgstr "adhésions" @@ -1228,9 +1233,3 @@ msgstr "Il n'y a pas de transaction associée à une remise ouverte." #: templates/treasury/remittance_list.html:54 msgid "Closed remittances" msgstr "Remises fermées" - -#~ msgid "Add roles" -#~ msgstr "Ajouter des rôles" - -#~ msgid "linked notes" -#~ msgstr "notes liées"