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

Le Fetch ouvre ensuite la page pour entrer un nouveau média (code moins sale)

This commit is contained in:
Yohann D'ANELLO 2020-02-20 13:52:50 +01:00
parent 0c9b3c4d5f
commit 4c55bdd200
4 changed files with 83 additions and 80 deletions

View File

@ -26,8 +26,6 @@ class MediaAdminForm(ModelForm):
Download data from bedeteque
:return True if success
"""
print(self.request.POST)
print('isbn' in self.request.POST)
scraper = BedetequeScraper()
r = scraper.search_by_isbn(isbn)
if not r:
@ -94,8 +92,11 @@ class MediaAdminForm(ModelForm):
"""
super().clean()
if "_isbn" in self.request.POST:
if "_isbn" in self.request.POST or "_isbn_addanother" in self.request.POST:
isbn = self.cleaned_data.get('isbn')
if "_isbn_addanother" in self.request.POST:
self.request.POST = self.request.POST.copy()
self.request.POST['_addanother'] = 42
if isbn:
# ISBN is present, try with bedeteque
scrap_result = self.download_data_bedeteque(isbn)

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-16 14:00+0200\n"
"POT-Creation-Date: 2020-02-20 13:50+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -13,7 +13,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: admin.py:32 models.py:24 models.py:56
#: admin.py:32 models.py:29 models.py:62
msgid "authors"
msgstr "auteurs"
@ -25,7 +25,7 @@ msgstr "URL externe"
msgid "Turn back"
msgstr "Rendre"
#: admin.py:85 models.py:112
#: admin.py:85 models.py:118
msgid "given back to"
msgstr "rendu à"
@ -33,18 +33,18 @@ msgstr "rendu à"
msgid "ISBN-10 or ISBN-13"
msgstr "ISBN-10 ou ISBN-13"
#: models.py:16 models.py:136
#: models.py:16 models.py:142
msgid "name"
msgstr "nom"
#: models.py:23
msgid "author"
msgstr "auteur"
#: models.py:23
#: models.py:21
msgid "note"
msgstr "note"
#: models.py:28
msgid "author"
msgstr "auteur"
#: models.py:35
msgid "ISBN"
msgstr "ISBN"
@ -53,118 +53,124 @@ msgstr "ISBN"
msgid "You may be able to scan it from a bar code."
msgstr "Peut souvent être scanné à partir du code barre."
#: models.py:41
#: models.py:42
msgid "title"
msgstr "titre"
#: models.py:45
#: models.py:46
msgid "subtitle"
msgstr "sous-titre"
#: models.py:51
#: models.py:52
msgid "external URL"
msgstr "URL externe"
#: models.py:56
#: models.py:57
msgid "side identifier"
msgstr "côte"
#: models.py:64
#: models.py:65
msgid "number of pages"
msgstr "nombre de pages"
#: models.py:69
#: models.py:70
msgid "publish date"
msgstr "date de publication"
#: models.py:81
#: models.py:82
msgid "medium"
msgstr "medium"
#: models.py:82
#: models.py:83
msgid "media"
msgstr "media"
#: models.py:94
#: models.py:95
msgid "borrower"
msgstr "emprunteur"
#: models.py:97
#: models.py:98
msgid "borrowed on"
msgstr "emprunté le"
#: models.py:102
#: models.py:103
msgid "given back on"
msgstr "rendu le"
#: models.py:108
#: models.py:109
msgid "borrowed with"
msgstr "emprunté avec"
#: models.py:109
#: models.py:110
msgid "The keyholder that registered this borrowed item."
msgstr "Le permanencier qui enregistre cet emprunt."
#: models.py:118
#: models.py:119
msgid "The keyholder to whom this item was given back."
msgstr "Le permanencier à qui l'emprunt a été rendu."
#: models.py:125
#: models.py:126
msgid "borrowed item"
msgstr "emprunt"
#: models.py:126
#: models.py:127
msgid "borrowed items"
msgstr "emprunts"
#: models.py:146
#: models.py:147
msgid "owner"
msgstr "propriétaire"
#: models.py:151
#: models.py:152
msgid "duration"
msgstr "durée"
#: models.py:155
#: models.py:156
msgid "minimum number of players"
msgstr "nombre minimum de joueurs"
#: models.py:159
#: models.py:160
msgid "maximum number of players"
msgstr "nombre maximum de joueurs"
#: models.py:165
#: models.py:166
msgid "comment"
msgstr "commentaire"
#: models.py:172
#: models.py:173
msgid "game"
msgstr "jeu"
#: models.py:173
#: models.py:174
msgid "games"
msgstr "jeux"
#: templates/media/isbn_button.html:3
msgid "Fetch data"
msgstr "Télécharger les données"
msgid "Fetch data and add another"
msgstr "Télécharger les données et ajouter un nouveau medium"
#: validators.py:20
#: templates/media/isbn_button.html:4
#, fuzzy
#| msgid "Fetch data"
msgid "Fetch only"
msgstr "Télécharger uniquement les données"
#: validators.py:19
msgid "Invalid ISBN: Not a string"
msgstr "ISBN invalide : ce n'est pas une chaîne de caractères"
#: validators.py:23
#: validators.py:22
msgid "Invalid ISBN: Wrong length"
msgstr "ISBN invalide : mauvaise longueur"
#: validators.py:26
#: validators.py:25
msgid "Invalid ISBN: Failed checksum"
msgstr "ISBN invalide : mauvais checksum"
#: validators.py:29
#: validators.py:28
msgid "Invalid ISBN: Only upper case allowed"
msgstr "ISBN invalide : seulement les majuscules sont autorisées"
#: views.py:41
#: views.py:44
msgid "Welcome to the Mediatek database"
msgstr "Bienvenue sur la base de données de la Mediatek"

View File

@ -1,4 +1,4 @@
{% load i18n %}
{% include "django/forms/widgets/input.html" %}
<input type="submit" value="{% trans "Fetch data" %}" name="_isbn">
<input type="hidden" name="_addanother" value="42">
<input type="submit" value="{% trans "Fetch data and add another" %}" name="_isbn_addanother">
<input type="submit" value="{% trans "Fetch only" %}" name="_isbn">

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-10 16:20+0200\n"
"POT-Creation-Date: 2020-02-20 13:51+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -13,39 +13,39 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: admin.py:32
#: admin.py:25
msgid "membership status"
msgstr "statut adhérent"
#: admin.py:37
#: admin.py:30
msgid "Yes"
msgstr "Oui"
#: admin.py:54
#: admin.py:47
msgid "Personal info"
msgstr ""
msgstr "Informations personnelles"
#: admin.py:56
#: admin.py:49
msgid "Permissions"
msgstr ""
#: admin.py:59
#: admin.py:52
msgid "Important dates"
msgstr ""
msgstr "Dates importantes"
#: admin.py:89
#: admin.py:82
msgid "An email to set the password was sent."
msgstr "Un mail pour initialiser le mot de passe a été envoyé."
#: admin.py:92
#: admin.py:85
msgid "The email is invalid."
msgstr "L'adresse mail est invalide."
#: admin.py:111
#: admin.py:103
msgid "Adhere"
msgstr "Adhérer"
#: admin.py:114
#: admin.py:106
msgid "is member"
msgstr "statut adhérent"
@ -69,7 +69,7 @@ msgstr "emprunts maximal"
msgid "Maximal amount of simultaneous borrowed item authorized."
msgstr "Nombre maximal d'objets empruntés en même temps."
#: models.py:33 models.py:67
#: models.py:33
msgid "comment"
msgstr "commentaire"
@ -82,46 +82,30 @@ msgid "date joined"
msgstr ""
#: models.py:55
msgid "name"
msgstr "nom"
#: models.py:62
msgid "owner"
msgstr "propriétaire"
#: models.py:74
msgid "key"
msgstr "clé"
#: models.py:75
msgid "keys"
msgstr "clés"
#: models.py:80
msgid "starting in"
msgstr "commence en"
#: models.py:81
#: models.py:56
msgid "Year in which the membership year starts."
msgstr "Année dans laquelle la plage d'adhésion commence."
#: models.py:85
#: models.py:60
msgid "ending in"
msgstr "finie en"
#: models.py:86
#: models.py:61
msgid "Year in which the membership year ends."
msgstr "Année dans laquelle la plage d'adhésion finie."
#: models.py:91
#: models.py:66
msgid "members"
msgstr "adhérents"
#: models.py:96
#: models.py:71
msgid "membership year"
msgstr "année d'adhésion"
#: models.py:97
#: models.py:72
msgid "membership years"
msgstr "années d'adhésion"
@ -133,6 +117,18 @@ msgstr ""
msgid "Save"
msgstr ""
#: views.py:40
#: views.py:43
msgid "Edit user profile"
msgstr "Editer le profil utilisateur"
#~ msgid "name"
#~ msgstr "nom"
#~ msgid "owner"
#~ msgstr "propriétaire"
#~ msgid "key"
#~ msgstr "clé"
#~ msgid "keys"
#~ msgstr "clés"