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 Download data from bedeteque
:return True if success :return True if success
""" """
print(self.request.POST)
print('isbn' in self.request.POST)
scraper = BedetequeScraper() scraper = BedetequeScraper()
r = scraper.search_by_isbn(isbn) r = scraper.search_by_isbn(isbn)
if not r: if not r:
@ -94,8 +92,11 @@ class MediaAdminForm(ModelForm):
""" """
super().clean() 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') 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: if isbn:
# ISBN is present, try with bedeteque # ISBN is present, try with bedeteque
scrap_result = self.download_data_bedeteque(isbn) scrap_result = self.download_data_bedeteque(isbn)

View File

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

View File

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

View File

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