diff --git a/apps/member/__init__.py b/apps/member/__init__.py index e69de29..6bb559b 100644 --- a/apps/member/__init__.py +++ b/apps/member/__init__.py @@ -0,0 +1 @@ +default_app_config = 'member.apps.MemberConfig' diff --git a/apps/member/admin.py b/apps/member/admin.py index 8c38f3f..5f3e6e7 100644 --- a/apps/member/admin.py +++ b/apps/member/admin.py @@ -1,3 +1,29 @@ -from django.contrib import admin +from django.contrib.auth.admin import admin, UserAdmin +from polymorphic.admin import PolymorphicParentModelAdmin, PolymorphicChildModelAdmin +from member.models import TFJMUser, AbstractDocument, Document, Solution, Synthesis -# Register your models here. + +@admin.register(TFJMUser) +class TFJMUserAdmin(UserAdmin): + list_display = ('email', 'first_name', 'last_name', 'role', ) + + +@admin.register(AbstractDocument) +class AbstractDocumentAdmin(PolymorphicParentModelAdmin): + child_models = (Document, Solution, Synthesis,) + polymorphic_list = True + + +@admin.register(Document) +class DocumentAdmin(PolymorphicChildModelAdmin): + pass + + +@admin.register(Solution) +class SolutionAdmin(PolymorphicChildModelAdmin): + pass + + +@admin.register(Synthesis) +class SynthesisAdmin(PolymorphicChildModelAdmin): + pass diff --git a/apps/member/apps.py b/apps/member/apps.py index b704170..6635e7e 100644 --- a/apps/member/apps.py +++ b/apps/member/apps.py @@ -1,5 +1,7 @@ from django.apps import AppConfig +from django.utils.translation import gettext_lazy as _ class MemberConfig(AppConfig): - name = 'apps.member' + name = 'member' + verbose_name = _('member') diff --git a/apps/member/models.py b/apps/member/models.py index 62ed9cf..c6fa1a3 100644 --- a/apps/member/models.py +++ b/apps/member/models.py @@ -139,6 +139,13 @@ class TFJMUser(AbstractUser): verbose_name = _("user") verbose_name_plural = _("users") + def save(self, *args, **kwargs): + self.username = self.email + super().save(*args, **kwargs) + + def __str__(self): + return self.first_name + " " + self.last_name + class AbstractDocument(PolymorphicModel): file = models.FileField( diff --git a/apps/tournament/__init__.py b/apps/tournament/__init__.py index e69de29..9868b56 100644 --- a/apps/tournament/__init__.py +++ b/apps/tournament/__init__.py @@ -0,0 +1 @@ +default_app_config = 'tournament.apps.TournamentConfig' diff --git a/apps/tournament/admin.py b/apps/tournament/admin.py index 8c38f3f..de69249 100644 --- a/apps/tournament/admin.py +++ b/apps/tournament/admin.py @@ -1,3 +1,18 @@ -from django.contrib import admin +from django.contrib.auth.admin import admin -# Register your models here. +from tournament.models import Team, Tournament, Payment + + +@admin.register(Team) +class TeamAdmin(admin.ModelAdmin): + pass + + +@admin.register(Tournament) +class TournamentAdmin(admin.ModelAdmin): + pass + + +@admin.register(Payment) +class PaymentAdmin(admin.ModelAdmin): + pass diff --git a/apps/tournament/apps.py b/apps/tournament/apps.py index eec1530..2df95c1 100644 --- a/apps/tournament/apps.py +++ b/apps/tournament/apps.py @@ -1,5 +1,7 @@ from django.apps import AppConfig +from django.utils.translation import gettext_lazy as _ class TournamentConfig(AppConfig): - name = 'apps.tournament' + name = 'tournament' + verbose_name = _('tournament') diff --git a/apps/tournament/models.py b/apps/tournament/models.py index 0628115..f4cf6da 100644 --- a/apps/tournament/models.py +++ b/apps/tournament/models.py @@ -169,3 +169,7 @@ class Payment(models.Model): ], verbose_name=_("validation status"), ) + + class Meta: + verbose_name = _("payment") + verbose_name_plural = _("payments") diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 22a99ba..edcc0a6 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -1,15 +1,15 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# FIRST AUTHOR yohann.danello@animath.fr, 2020. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: TFJM2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-04-29 02:09+0000\n" -"PO-Revision-Date: 2020-04-29 02:09+0000\n" +"POT-Creation-Date: 2020-04-29 02:45+0000\n" +"PO-Revision-Date: 2020-04-29 02:30+0000\n" "Last-Translator: Yohann D'ANELLO \n" "Language-Team: fr \n" "Language: fr\n" @@ -18,11 +18,15 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: apps/member/apps.py:7 +msgid "member" +msgstr "membre" + #: apps/member/models.py:15 msgid "email" msgstr "Adresse électronique" -#: apps/member/models.py:23 apps/member/models.py:154 +#: apps/member/models.py:23 apps/member/models.py:161 #: apps/tournament/models.py:129 apps/tournament/models.py:146 msgid "team" msgstr "équipe" @@ -43,8 +47,7 @@ msgstr "Femme" msgid "Non binary" msgstr "Non binaire" -#: apps/member/models.py:41 -#: apps/member/models.py:48 +#: apps/member/models.py:41 apps/member/models.py:48 msgid "address" msgstr "adresse" @@ -125,84 +128,84 @@ msgstr "utilisateur" msgid "users" msgstr "utilisateurs" -#: apps/member/models.py:147 +#: apps/member/models.py:154 msgid "file" msgstr "fichier" -#: apps/member/models.py:161 apps/tournament/models.py:69 -#: apps/tournament/models.py:87 +#: apps/member/models.py:168 apps/tournament/apps.py:7 +#: apps/tournament/models.py:69 apps/tournament/models.py:87 msgid "tournament" msgstr "tournoi" -#: apps/member/models.py:167 +#: apps/member/models.py:174 msgid "Parental consent" msgstr "Autorisation parentale" -#: apps/member/models.py:168 +#: apps/member/models.py:175 msgid "Photo consent" msgstr "Autorisation de droit à l'image" -#: apps/member/models.py:169 +#: apps/member/models.py:176 msgid "Sanitary plug" msgstr "Fiche sanitaire" -#: apps/member/models.py:170 +#: apps/member/models.py:177 msgid "Motivation letter" msgstr "Lettre de motivation" -#: apps/member/models.py:171 apps/tournament/models.py:157 +#: apps/member/models.py:178 apps/tournament/models.py:157 msgid "Scholarship" msgstr "Bourse" -#: apps/member/models.py:172 +#: apps/member/models.py:179 msgid "Solution" msgstr "Solution" -#: apps/member/models.py:173 +#: apps/member/models.py:180 msgid "Synthesis" msgstr "Synthèse" -#: apps/member/models.py:175 +#: apps/member/models.py:182 msgid "type" msgstr "type" -#: apps/member/models.py:180 +#: apps/member/models.py:187 msgid "uploaded at" msgstr "téléversé le" -#: apps/member/models.py:184 +#: apps/member/models.py:191 msgid "abstract document" -msgstr "document abstrait" +msgstr "document générique" -#: apps/member/models.py:185 +#: apps/member/models.py:192 msgid "abstract documents" -msgstr "documents abstraits" +msgstr "documents génériques" -#: apps/member/models.py:190 +#: apps/member/models.py:197 msgid "document" msgstr "document" -#: apps/member/models.py:191 +#: apps/member/models.py:198 msgid "documents" msgstr "documents" -#: apps/member/models.py:196 apps/member/models.py:210 +#: apps/member/models.py:203 apps/member/models.py:217 msgid "problem" msgstr "problème" -#: apps/member/models.py:204 +#: apps/member/models.py:211 msgid "solution" msgstr "solution" -#: apps/member/models.py:205 +#: apps/member/models.py:212 msgid "solutions" msgstr "solutions" -#: apps/member/models.py:218 +#: apps/member/models.py:225 msgid "synthesis" msgstr "synthèse" -#: apps/member/models.py:219 +#: apps/member/models.py:226 msgid "syntheses" msgstr "synthèses" @@ -310,6 +313,14 @@ msgstr "Espèces" msgid "payment method" msgstr "moyen de paiement" +#: apps/tournament/models.py:174 +msgid "payment" +msgstr "paiement" + +#: apps/tournament/models.py:175 +msgid "payments" +msgstr "paiements" + #: tfjm/settings.py:123 msgid "English" msgstr "Anglais"