1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2024-12-24 17:42:23 +00:00

Add author note

This commit is contained in:
Yohann D'ANELLO 2020-02-10 17:27:30 +01:00
parent 11f0eff4d4
commit ea821483d0
4 changed files with 56 additions and 25 deletions

View File

@ -99,6 +99,10 @@ class MediaAdminForm(ModelForm):
self.download_data_openlibrary(isbn)
if self.cleaned_data['authors']:
authors: list = self.cleaned_data['authors']
def sort(author):
return str(-author.note) + "." + author.name
authors.sort(key=sort)
author_name = self.cleaned_data['authors'][0].name
if ',' not in author_name and ' ' in author_name:
author_name = author_name.split(' ')[-1]

View File

@ -41,103 +41,107 @@ msgstr "nom"
msgid "author"
msgstr "auteur"
#: models.py:30
#: models.py:23
msgid "note"
msgstr "note"
#: models.py:35
msgid "ISBN"
msgstr "ISBN"
#: models.py:31
#: models.py:36
msgid "You may be able to scan it from a bar code."
msgstr "Peut souvent être scanné à partir du code barre."
#: models.py:36
#: models.py:41
msgid "title"
msgstr "titre"
#: models.py:40
#: models.py:45
msgid "subtitle"
msgstr "sous-titre"
#: models.py:46
#: models.py:51
msgid "external URL"
msgstr "URL externe"
#: models.py:51
#: models.py:56
msgid "side identifier"
msgstr "côte"
#: models.py:59
#: models.py:64
msgid "number of pages"
msgstr "nombre de pages"
#: models.py:64
#: models.py:69
msgid "publish date"
msgstr "date de publication"
#: models.py:76
#: models.py:81
msgid "medium"
msgstr "medium"
#: models.py:77
#: models.py:82
msgid "media"
msgstr "media"
#: models.py:89
#: models.py:94
msgid "borrower"
msgstr "emprunteur"
#: models.py:92
#: models.py:97
msgid "borrowed on"
msgstr "emprunté le"
#: models.py:97
#: models.py:102
msgid "given back on"
msgstr "rendu le"
#: models.py:103
#: models.py:108
msgid "borrowed with"
msgstr "emprunté avec"
#: models.py:104
#: models.py:109
msgid "The keyholder that registered this borrowed item."
msgstr "Le permanencier qui enregistre cet emprunt."
#: models.py:113
#: models.py:118
msgid "The keyholder to whom this item was given back."
msgstr "Le permanencier à qui l'emprunt a été rendu."
#: models.py:120
#: models.py:125
msgid "borrowed item"
msgstr "emprunt"
#: models.py:121
#: models.py:126
msgid "borrowed items"
msgstr "emprunts"
#: models.py:141
#: models.py:146
msgid "owner"
msgstr "propriétaire"
#: models.py:146
#: models.py:151
msgid "duration"
msgstr "durée"
#: models.py:150
#: models.py:155
msgid "minimum number of players"
msgstr "nombre minimum de joueurs"
#: models.py:154
#: models.py:159
msgid "maximum number of players"
msgstr "nombre maximum de joueurs"
#: models.py:160
#: models.py:165
msgid "comment"
msgstr "commentaire"
#: models.py:167
#: models.py:172
msgid "game"
msgstr "jeu"
#: models.py:168
#: models.py:173
msgid "games"
msgstr "jeux"

View File

@ -0,0 +1,18 @@
# Generated by Django 2.2.4 on 2020-02-10 16:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('media', '0024_auto_20190816_1356'),
]
operations = [
migrations.AddField(
model_name='auteur',
name='note',
field=models.IntegerField(default=0, verbose_name='note'),
),
]

View File

@ -16,6 +16,11 @@ class Auteur(models.Model):
verbose_name=_('name'),
)
note = models.IntegerField(
default=0,
verbose_name=_("note"),
)
def __str__(self):
return self.name