Django admin management

This commit is contained in:
Yohann D'ANELLO 2020-04-29 04:51:25 +02:00
parent 706de5bd41
commit bc869241b6
9 changed files with 104 additions and 35 deletions

View File

@ -0,0 +1 @@
default_app_config = 'member.apps.MemberConfig'

View File

@ -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

View File

@ -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')

View File

@ -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(

View File

@ -0,0 +1 @@
default_app_config = 'tournament.apps.TournamentConfig'

View File

@ -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

View File

@ -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')

View File

@ -169,3 +169,7 @@ class Payment(models.Model):
],
verbose_name=_("validation status"),
)
class Meta:
verbose_name = _("payment")
verbose_name_plural = _("payments")

View File

@ -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 <EMAIL@ADDRESS>, 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 <yohann.danello@animath.fr>\n"
"Language-Team: fr <LL@li.org>\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"