mirror of
				https://gitlab.crans.org/mediatek/med.git
				synced 2025-10-31 03:39:54 +01:00 
			
		
		
		
	Compare commits
	
		
			2 Commits
		
	
	
		
			ae0d1a080e
			...
			079ade9bbb
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 079ade9bbb | |||
| 4928b555b7 | 
| @@ -9,6 +9,7 @@ import unicodedata | ||||
| from urllib.error import HTTPError | ||||
| import urllib.request | ||||
|  | ||||
| from django.core.exceptions import ValidationError | ||||
| from django.db.models import QuerySet | ||||
| from django.forms import ModelForm | ||||
| from django.utils.translation import gettext_lazy as _ | ||||
| @@ -320,6 +321,13 @@ class MediaAdminForm(ModelForm): | ||||
|         return self.cleaned_data | ||||
|  | ||||
|     def _clean_fields(self): | ||||
|         # First clean ISBN field | ||||
|         isbn_field = self.fields['isbn'] | ||||
|         isbn = isbn_field.widget.value_from_datadict( | ||||
|             self.data, self.files, self.add_prefix('isbn')) | ||||
|         isbn = isbn_field.clean(isbn) | ||||
|         self.cleaned_data['isbn'] = isbn | ||||
|  | ||||
|         for name, field in self.fields.items(): | ||||
|             # value_from_datadict() gets the data from the data dictionaries. | ||||
|             # Each widget type knows how to retrieve its own data, because some | ||||
| @@ -329,7 +337,6 @@ class MediaAdminForm(ModelForm): | ||||
|             else: | ||||
|                 value = field.widget.value_from_datadict( | ||||
|                     self.data, self.files, self.add_prefix(name)) | ||||
|             from django.core.exceptions import ValidationError | ||||
|             try: | ||||
|                 # We don't want to check a field when we enter an ISBN. | ||||
|                 if "isbn" not in self.data \ | ||||
|   | ||||
| @@ -3,7 +3,7 @@ msgid "" | ||||
| msgstr "" | ||||
| "Project-Id-Version: PACKAGE VERSION\n" | ||||
| "Report-Msgid-Bugs-To: \n" | ||||
| "POT-Creation-Date: 2021-10-23 18:27+0200\n" | ||||
| "POT-Creation-Date: 2021-10-26 15:14+0200\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,20 +13,20 @@ msgstr "" | ||||
| "Content-Transfer-Encoding: 8bit\n" | ||||
| "Plural-Forms: nplurals=2; plural=(n > 1);\n" | ||||
|  | ||||
| #: admin.py:33 admin.py:88 admin.py:99 models.py:29 models.py:65 models.py:130 | ||||
| #: models.py:192 models.py:243 models.py:274 | ||||
| #: admin.py:46 admin.py:102 admin.py:114 models.py:30 models.py:77 | ||||
| #: models.py:149 models.py:221 models.py:290 models.py:348 models.py:394 | ||||
| msgid "authors" | ||||
| msgstr "auteurs" | ||||
|  | ||||
| #: admin.py:43 | ||||
| #: admin.py:56 | ||||
| msgid "external url" | ||||
| msgstr "URL externe" | ||||
|  | ||||
| #: admin.py:126 | ||||
| #: admin.py:142 | ||||
| msgid "Turn back" | ||||
| msgstr "Rendre" | ||||
|  | ||||
| #: admin.py:129 models.py:407 | ||||
| #: admin.py:145 models.py:574 | ||||
| msgid "given back to" | ||||
| msgstr "rendu à" | ||||
|  | ||||
| @@ -38,220 +38,249 @@ msgstr "ISBN-10 ou ISBN-13" | ||||
| msgid "This ISBN is not found." | ||||
| msgstr "L'ISBN n'a pas été trouvé." | ||||
|  | ||||
| #: models.py:16 models.py:431 | ||||
| msgid "name" | ||||
| msgstr "nom" | ||||
|  | ||||
| #: models.py:21 | ||||
| msgid "note" | ||||
| msgstr "note" | ||||
|  | ||||
| #: models.py:28 | ||||
| msgid "author" | ||||
| msgstr "auteur" | ||||
|  | ||||
| #: models.py:35 models.py:100 models.py:162 models.py:345 | ||||
| msgid "ISBN" | ||||
| msgstr "ISBN" | ||||
|  | ||||
| #: models.py:36 models.py:101 models.py:163 models.py:346 | ||||
| msgid "You may be able to scan it from a bar code." | ||||
| msgstr "Peut souvent être scanné à partir du code barre." | ||||
|  | ||||
| #: models.py:43 models.py:108 models.py:170 models.py:224 models.py:263 | ||||
| #: models.py:294 | ||||
| msgid "title" | ||||
| msgstr "titre" | ||||
|  | ||||
| #: models.py:48 models.py:113 models.py:175 | ||||
| msgid "subtitle" | ||||
| msgstr "sous-titre" | ||||
|  | ||||
| #: models.py:54 models.py:119 models.py:181 | ||||
| msgid "external URL" | ||||
| msgstr "URL externe" | ||||
|  | ||||
| #: models.py:59 models.py:124 models.py:186 models.py:229 models.py:268 | ||||
| msgid "side identifier" | ||||
| msgstr "côte" | ||||
|  | ||||
| #: models.py:69 models.py:134 models.py:196 | ||||
| msgid "number of pages" | ||||
| msgstr "nombre de pages" | ||||
|  | ||||
| #: models.py:75 models.py:140 models.py:202 | ||||
| msgid "publish date" | ||||
| msgstr "date de publication" | ||||
|  | ||||
| #: models.py:81 models.py:146 models.py:208 models.py:247 models.py:278 | ||||
| #: models.py:329 models.py:363 | ||||
| msgid "present" | ||||
| msgstr "présent" | ||||
|  | ||||
| #: models.py:82 models.py:147 models.py:209 models.py:248 models.py:279 | ||||
| #: models.py:330 models.py:364 | ||||
| msgid "Tell that the medium is present in the Mediatek." | ||||
| msgstr "Indique que le medium est présent à la Mediatek." | ||||
|  | ||||
| #: models.py:93 models.py:355 | ||||
| msgid "comic" | ||||
| msgstr "BD" | ||||
|  | ||||
| #: models.py:94 | ||||
| msgid "comics" | ||||
| msgstr "BDs" | ||||
|  | ||||
| #: models.py:155 | ||||
| msgid "manga" | ||||
| msgstr "manga" | ||||
|  | ||||
| #: models.py:156 | ||||
| msgid "mangas" | ||||
| msgstr "mangas" | ||||
|  | ||||
| #: models.py:217 | ||||
| msgid "novel" | ||||
| msgstr "roman" | ||||
|  | ||||
| #: models.py:218 | ||||
| msgid "novels" | ||||
| msgstr "romans" | ||||
|  | ||||
| #: models.py:234 | ||||
| msgid "rounds per minute" | ||||
| msgstr "tours par minute" | ||||
|  | ||||
| #: models.py:236 | ||||
| msgid "33 RPM" | ||||
| msgstr "33 TPM" | ||||
|  | ||||
| #: models.py:237 | ||||
| msgid "45 RPM" | ||||
| msgstr "45 TPM" | ||||
|  | ||||
| #: models.py:256 | ||||
| msgid "vinyl" | ||||
| msgstr "vinyle" | ||||
|  | ||||
| #: models.py:257 | ||||
| msgid "vinyls" | ||||
| msgstr "vinyles" | ||||
|  | ||||
| #: models.py:287 | ||||
| msgid "CD" | ||||
| msgstr "CD" | ||||
|  | ||||
| #: models.py:288 | ||||
| #: management/commands/migrate_to_new_format.py:52 models.py:408 models.py:415 | ||||
| msgid "CDs" | ||||
| msgstr "CDs" | ||||
|  | ||||
| #: models.py:299 | ||||
| msgid "number" | ||||
| msgstr "nombre" | ||||
| #: management/commands/migrate_to_new_format.py:52 models.py:407 models.py:414 | ||||
| msgid "CD" | ||||
| msgstr "CD" | ||||
|  | ||||
| #: models.py:303 | ||||
| msgid "year" | ||||
| msgstr "année" | ||||
| #: management/commands/migrate_to_new_format.py:68 models.py:362 models.py:377 | ||||
| msgid "vinyls" | ||||
| msgstr "vinyles" | ||||
|  | ||||
| #: models.py:310 | ||||
| msgid "month" | ||||
| msgstr "mois" | ||||
| #: management/commands/migrate_to_new_format.py:68 models.py:361 models.py:376 | ||||
| msgid "vinyl" | ||||
| msgstr "vinyle" | ||||
|  | ||||
| #: models.py:317 | ||||
| msgid "day" | ||||
| msgstr "jour" | ||||
|  | ||||
| #: models.py:324 | ||||
| msgid "double" | ||||
| msgstr "double" | ||||
|  | ||||
| #: models.py:338 | ||||
| msgid "review" | ||||
| msgstr "revue" | ||||
|  | ||||
| #: models.py:339 | ||||
| #: management/commands/migrate_to_new_format.py:86 models.py:466 models.py:506 | ||||
| msgid "reviews" | ||||
| msgstr "revues" | ||||
|  | ||||
| #: models.py:353 | ||||
| msgid "type" | ||||
| msgstr "type" | ||||
| #: management/commands/migrate_to_new_format.py:86 models.py:465 models.py:505 | ||||
| msgid "review" | ||||
| msgstr "revue" | ||||
|  | ||||
| #: models.py:356 | ||||
| msgid "Manga" | ||||
| msgstr "Manga" | ||||
| #: management/commands/migrate_to_new_format.py:106 models.py:629 models.py:670 | ||||
| msgid "games" | ||||
| msgstr "jeux" | ||||
|  | ||||
| #: models.py:357 | ||||
| msgid "Roman" | ||||
| msgstr "Roman" | ||||
|  | ||||
| #: models.py:369 | ||||
| msgid "future medium" | ||||
| msgstr "medium à importer" | ||||
|  | ||||
| #: models.py:370 | ||||
| msgid "future media" | ||||
| msgstr "medias à importer" | ||||
|  | ||||
| #: models.py:384 | ||||
| msgid "borrower" | ||||
| msgstr "emprunteur" | ||||
|  | ||||
| #: models.py:387 | ||||
| msgid "borrowed on" | ||||
| msgstr "emprunté le" | ||||
|  | ||||
| #: models.py:392 | ||||
| msgid "given back on" | ||||
| msgstr "rendu le" | ||||
|  | ||||
| #: models.py:398 | ||||
| msgid "borrowed with" | ||||
| msgstr "emprunté avec" | ||||
|  | ||||
| #: models.py:399 | ||||
| msgid "The keyholder that registered this borrowed item." | ||||
| msgstr "Le permanencier qui enregistre cet emprunt." | ||||
|  | ||||
| #: models.py:408 | ||||
| msgid "The keyholder to whom this item was given back." | ||||
| msgstr "Le permanencier à qui l'emprunt a été rendu." | ||||
|  | ||||
| #: models.py:415 | ||||
| msgid "borrowed item" | ||||
| msgstr "emprunt" | ||||
|  | ||||
| #: models.py:416 | ||||
| msgid "borrowed items" | ||||
| msgstr "emprunts" | ||||
|  | ||||
| #: models.py:436 | ||||
| msgid "owner" | ||||
| msgstr "propriétaire" | ||||
|  | ||||
| #: models.py:441 | ||||
| msgid "duration" | ||||
| msgstr "durée" | ||||
|  | ||||
| #: models.py:445 | ||||
| msgid "minimum number of players" | ||||
| msgstr "nombre minimum de joueurs" | ||||
|  | ||||
| #: models.py:449 | ||||
| msgid "maximum number of players" | ||||
| msgstr "nombre maximum de joueurs" | ||||
|  | ||||
| #: models.py:454 | ||||
| msgid "comment" | ||||
| msgstr "commentaire" | ||||
|  | ||||
| #: models.py:461 | ||||
| #: management/commands/migrate_to_new_format.py:106 models.py:628 models.py:669 | ||||
| msgid "game" | ||||
| msgstr "jeu" | ||||
|  | ||||
| #: models.py:462 | ||||
| msgid "games" | ||||
| msgstr "jeux" | ||||
| #: models.py:17 models.py:598 | ||||
| msgid "name" | ||||
| msgstr "nom" | ||||
|  | ||||
| #: models.py:22 | ||||
| msgid "note" | ||||
| msgstr "note" | ||||
|  | ||||
| #: models.py:29 | ||||
| msgid "author" | ||||
| msgstr "auteur" | ||||
|  | ||||
| #: models.py:37 models.py:127 models.py:199 models.py:268 models.py:329 | ||||
| #: models.py:383 models.py:421 | ||||
| msgid "title" | ||||
| msgstr "titre" | ||||
|  | ||||
| #: models.py:41 models.py:165 models.py:237 models.py:306 models.py:352 | ||||
| #: models.py:398 models.py:456 models.py:530 | ||||
| msgid "present" | ||||
| msgstr "présent" | ||||
|  | ||||
| #: models.py:42 models.py:166 models.py:238 models.py:307 models.py:353 | ||||
| #: models.py:399 models.py:457 models.py:531 | ||||
| msgid "Tell that the medium is present in the Mediatek." | ||||
| msgstr "Indique que le medium est présent à la Mediatek." | ||||
|  | ||||
| #: models.py:60 | ||||
| msgid "borrowable" | ||||
| msgstr "empruntable" | ||||
|  | ||||
| #: models.py:61 | ||||
| msgid "borrowables" | ||||
| msgstr "empruntables" | ||||
|  | ||||
| #: models.py:66 models.py:138 models.py:210 models.py:279 | ||||
| msgid "external URL" | ||||
| msgstr "URL externe" | ||||
|  | ||||
| #: models.py:71 models.py:143 models.py:215 models.py:284 models.py:334 | ||||
| #: models.py:388 | ||||
| msgid "side identifier" | ||||
| msgstr "côte" | ||||
|  | ||||
| #: models.py:81 | ||||
| msgid "medium" | ||||
| msgstr "medium" | ||||
|  | ||||
| #: models.py:82 | ||||
| msgid "media" | ||||
| msgstr "media" | ||||
|  | ||||
| #: models.py:87 models.py:119 models.py:191 models.py:260 models.py:512 | ||||
| msgid "ISBN" | ||||
| msgstr "ISBN" | ||||
|  | ||||
| #: models.py:88 models.py:120 models.py:192 models.py:261 models.py:513 | ||||
| msgid "You may be able to scan it from a bar code." | ||||
| msgstr "Peut souvent être scanné à partir du code barre." | ||||
|  | ||||
| #: models.py:95 models.py:132 models.py:204 models.py:273 | ||||
| msgid "subtitle" | ||||
| msgstr "sous-titre" | ||||
|  | ||||
| #: models.py:101 models.py:153 models.py:225 models.py:294 | ||||
| msgid "number of pages" | ||||
| msgstr "nombre de pages" | ||||
|  | ||||
| #: models.py:107 models.py:159 models.py:231 models.py:300 | ||||
| msgid "publish date" | ||||
| msgstr "date de publication" | ||||
|  | ||||
| #: models.py:113 | ||||
| msgid "book" | ||||
| msgstr "livre" | ||||
|  | ||||
| #: models.py:114 | ||||
| msgid "books" | ||||
| msgstr "livres" | ||||
|  | ||||
| #: models.py:177 models.py:184 | ||||
| msgid "comic" | ||||
| msgstr "BD" | ||||
|  | ||||
| #: models.py:178 models.py:185 | ||||
| msgid "comics" | ||||
| msgstr "BDs" | ||||
|  | ||||
| #: models.py:246 models.py:253 | ||||
| msgid "manga" | ||||
| msgstr "manga" | ||||
|  | ||||
| #: models.py:247 models.py:254 | ||||
| msgid "mangas" | ||||
| msgstr "mangas" | ||||
|  | ||||
| #: models.py:315 models.py:322 | ||||
| msgid "novel" | ||||
| msgstr "roman" | ||||
|  | ||||
| #: models.py:316 models.py:323 | ||||
| msgid "novels" | ||||
| msgstr "romans" | ||||
|  | ||||
| #: models.py:339 models.py:368 | ||||
| msgid "rounds per minute" | ||||
| msgstr "tours par minute" | ||||
|  | ||||
| #: models.py:341 models.py:370 | ||||
| msgid "33 RPM" | ||||
| msgstr "33 TPM" | ||||
|  | ||||
| #: models.py:342 models.py:371 | ||||
| msgid "45 RPM" | ||||
| msgstr "45 TPM" | ||||
|  | ||||
| #: models.py:426 models.py:472 | ||||
| msgid "number" | ||||
| msgstr "nombre" | ||||
|  | ||||
| #: models.py:430 models.py:476 | ||||
| msgid "year" | ||||
| msgstr "année" | ||||
|  | ||||
| #: models.py:437 models.py:483 | ||||
| msgid "month" | ||||
| msgstr "mois" | ||||
|  | ||||
| #: models.py:444 models.py:490 | ||||
| msgid "day" | ||||
| msgstr "jour" | ||||
|  | ||||
| #: models.py:451 models.py:497 | ||||
| msgid "double" | ||||
| msgstr "double" | ||||
|  | ||||
| #: models.py:520 | ||||
| msgid "type" | ||||
| msgstr "type" | ||||
|  | ||||
| #: models.py:522 | ||||
| msgid "Comic" | ||||
| msgstr "BD" | ||||
|  | ||||
| #: models.py:523 | ||||
| msgid "Manga" | ||||
| msgstr "Manga" | ||||
|  | ||||
| #: models.py:524 | ||||
| msgid "Roman" | ||||
| msgstr "Roman" | ||||
|  | ||||
| #: models.py:536 | ||||
| msgid "future medium" | ||||
| msgstr "medium à importer" | ||||
|  | ||||
| #: models.py:537 | ||||
| msgid "future media" | ||||
| msgstr "medias à importer" | ||||
|  | ||||
| #: models.py:551 | ||||
| msgid "borrower" | ||||
| msgstr "emprunteur" | ||||
|  | ||||
| #: models.py:554 | ||||
| msgid "borrowed on" | ||||
| msgstr "emprunté le" | ||||
|  | ||||
| #: models.py:559 | ||||
| msgid "given back on" | ||||
| msgstr "rendu le" | ||||
|  | ||||
| #: models.py:565 | ||||
| msgid "borrowed with" | ||||
| msgstr "emprunté avec" | ||||
|  | ||||
| #: models.py:566 | ||||
| msgid "The keyholder that registered this borrowed item." | ||||
| msgstr "Le permanencier qui enregistre cet emprunt." | ||||
|  | ||||
| #: models.py:575 | ||||
| msgid "The keyholder to whom this item was given back." | ||||
| msgstr "Le permanencier à qui l'emprunt a été rendu." | ||||
|  | ||||
| #: models.py:582 | ||||
| msgid "borrowed item" | ||||
| msgstr "emprunt" | ||||
|  | ||||
| #: models.py:583 | ||||
| msgid "borrowed items" | ||||
| msgstr "emprunts" | ||||
|  | ||||
| #: models.py:603 models.py:644 | ||||
| msgid "owner" | ||||
| msgstr "propriétaire" | ||||
|  | ||||
| #: models.py:608 models.py:649 | ||||
| msgid "duration" | ||||
| msgstr "durée" | ||||
|  | ||||
| #: models.py:612 models.py:653 | ||||
| msgid "minimum number of players" | ||||
| msgstr "nombre minimum de joueurs" | ||||
|  | ||||
| #: models.py:616 models.py:657 | ||||
| msgid "maximum number of players" | ||||
| msgstr "nombre maximum de joueurs" | ||||
|  | ||||
| #: models.py:621 models.py:662 | ||||
| msgid "comment" | ||||
| msgstr "commentaire" | ||||
|  | ||||
| #: templates/media/generate_side_identifier.html:3 | ||||
| msgid "Generate side identifier" | ||||
| @@ -277,6 +306,6 @@ msgstr "ISBN invalide : mauvaise longueur" | ||||
| msgid "Invalid ISBN: Only upper case allowed" | ||||
| msgstr "ISBN invalide : seulement les majuscules sont autorisées" | ||||
|  | ||||
| #: views.py:51 | ||||
| #: views.py:47 | ||||
| msgid "Welcome to the Mediatek database" | ||||
| msgstr "Bienvenue sur la base de données de la Mediatek" | ||||
|   | ||||
| @@ -36,22 +36,22 @@ | ||||
|         document.getElementById("isbn").focus(); | ||||
|  | ||||
|         let bd_request = new XMLHttpRequest(); | ||||
|         bd_request.open('GET', '/api/media/bd/?search=' + isbn, true); | ||||
|         bd_request.open('GET', '/api/media/comic/?search=' + isbn, true); | ||||
|         bd_request.onload = function () { | ||||
|             let data = JSON.parse(this.response); | ||||
|             data.results.forEach(bd => { | ||||
|                 let present = bd.present; | ||||
|                 if (markAsPresent && isbn === bd.isbn) { | ||||
|             data.results.forEach(comic => { | ||||
|                 let present = comic.present; | ||||
|                 if (markAsPresent && isbn === comic.isbn) { | ||||
|                     present = true; | ||||
|                     let presentRequest = new XMLHttpRequest(); | ||||
|                     presentRequest.open("GET", "/media/mark-as-present/bd/" + bd.id + "/", true); | ||||
|                     presentRequest.open("GET", "/media/mark-as-present/bd/" + comic.id + "/", true); | ||||
|                     presentRequest.send(); | ||||
|                 } | ||||
|                 result_div.innerHTML += "<li id='bd_" + bd.id + "'>" + | ||||
|                     "<a href='/database/media/bd/" + bd.id + "/change/'>BD : " | ||||
|                     + bd.title + (bd.subtitle ? " - " + bd.subtitle : "") + "</a>" | ||||
|                     + (present ? " (<a class='absent' href='#' onclick=\"markAsPresent('bd', " + bd.id + ", false)\">marquer comme absent</a>)" | ||||
|                         : " (absent, <a class='present' href='#' onclick=\"markAsPresent('bd', " + bd.id + ")\">marquer comme présent</a>)") + "</li>"; | ||||
|                 result_div.innerHTML += "<li id='comic_" + comic.id + "'>" + | ||||
|                     "<a href='/database/media/comic/" + comic.id + "/change/'>BD : " | ||||
|                     + comic.title + (comic.subtitle ? " - " + comic.subtitle : "") + "</a>" | ||||
|                     + (present ? " (<a class='absent' href='#' onclick=\"markAsPresent('bd', " + comic.id + ", false)\">marquer comme absent</a>)" | ||||
|                         : " (absent, <a class='present' href='#' onclick=\"markAsPresent('bd', " + comic.id + ")\">marquer comme présent</a>)") + "</li>"; | ||||
|             }); | ||||
|         } | ||||
|         bd_request.send(); | ||||
| @@ -92,35 +92,35 @@ | ||||
|         cd_request.send(); | ||||
|  | ||||
|         let vinyle_request = new XMLHttpRequest(); | ||||
|         vinyle_request.open('GET', '/api/media/vinyle/?search=' + isbn, true); | ||||
|         vinyle_request.open('GET', '/api/media/vinyl/?search=' + isbn, true); | ||||
|         vinyle_request.onload = function () { | ||||
|             let data = JSON.parse(this.response); | ||||
|             data.results.forEach(vinyle => { | ||||
|                 let present = markAsPresent || vinyle.present; | ||||
|                 result_div.innerHTML += "<li id='vinyle_" + vinyle.id + "'>" + | ||||
|                     "<a href='/database/media/vinyle/" + vinyle.id + "/change/'>Vinyle : " + vinyle.title + "</a>" | ||||
|                     + (present ? " (<a class='absent' href='#' onclick=\"markAsPresent('vinyle', " + vinyle.id + ", false)\">marquer comme absent</a>)" | ||||
|                         : " (absent, <a class='present' href='#' onclick=\"markAsPresent('vinyle', " + vinyle.id + ")\">marquer comme présent</a>)") + "</li>"; | ||||
|             data.results.forEach(vinyl => { | ||||
|                 let present = markAsPresent || vinyl.present; | ||||
|                 result_div.innerHTML += "<li id='vinyl_" + vinyl.id + "'>" + | ||||
|                     "<a href='/database/media/vinyl/" + vinyl.id + "/change/'>Vinyle : " + vinyl.title + "</a>" | ||||
|                     + (present ? " (<a class='absent' href='#' onclick=\"markAsPresent('vinyl', " + vinyl.id + ", false)\">marquer comme absent</a>)" | ||||
|                         : " (absent, <a class='present' href='#' onclick=\"markAsPresent('vinyl', " + vinyl.id + ")\">marquer comme présent</a>)") + "</li>"; | ||||
|             }); | ||||
|         } | ||||
|         vinyle_request.send(); | ||||
|  | ||||
|         let roman_request = new XMLHttpRequest(); | ||||
|         roman_request.open('GET', '/api/media/roman/?search=' + isbn, true); | ||||
|         roman_request.open('GET', '/api/media/novel/?search=' + isbn, true); | ||||
|         roman_request.onload = function () { | ||||
|             let data = JSON.parse(this.response); | ||||
|             data.results.forEach(roman => { | ||||
|                 let present = roman.present; | ||||
|                 if (markAsPresent && isbn === roman.isbn) { | ||||
|             data.results.forEach(novel => { | ||||
|                 let present = novel.present; | ||||
|                 if (markAsPresent && isbn === novel.isbn) { | ||||
|                     present = true; | ||||
|                     let presentRequest = new XMLHttpRequest(); | ||||
|                     presentRequest.open("GET", "/media/mark-as-present/roman/" + roman.id + "/", true); | ||||
|                     presentRequest.open("GET", "/media/mark-as-present/novel/" + novel.id + "/", true); | ||||
|                     presentRequest.send(); | ||||
|                 } | ||||
|                 result_div.innerHTML += "<li id='roman_" + roman.id + "'>" + | ||||
|                     "<a href='/database/media/roman/" + roman.id + "/change/'>Roman : " + roman.title + "</a>" | ||||
|                     + (present ? " (<a class='absent' href='#' onclick=\"markAsPresent('roman', " + roman.id + ", false)\">marquer comme absent</a>)" | ||||
|                         : " (absent, <a class='present' href='#' onclick=\"markAsPresent('roman', " + roman.id + ")\">marquer comme présent</a>)") + "</li>"; | ||||
|                 result_div.innerHTML += "<li id='roman_" + novel.id + "'>" + | ||||
|                     "<a href='/database/media/roman/" + novel.id + "/change/'>Roman : " + novel.title + "</a>" | ||||
|                     + (present ? " (<a class='absent' href='#' onclick=\"markAsPresent('novel', " + novel.id + ", false)\">marquer comme absent</a>)" | ||||
|                         : " (absent, <a class='present' href='#' onclick=\"markAsPresent('novel', " + novel.id + ")\">marquer comme présent</a>)") + "</li>"; | ||||
|             }); | ||||
|         } | ||||
|         roman_request.send(); | ||||
|   | ||||
| @@ -12,7 +12,7 @@ urlpatterns = [ | ||||
|     url(r'^retour_emprunt/(?P<empruntid>[0-9]+)$', views.retour_emprunt, | ||||
|         name='retour-emprunt'), | ||||
|     path('find/', views.FindMediumView.as_view(), name="find"), | ||||
|     path('mark-as-present/bd/<int:pk>/', | ||||
|     path('mark-as-present/comic/<int:pk>/', | ||||
|          views.MarkComicAsPresent.as_view(), | ||||
|          name="mark_comic_as_present"), | ||||
|     path('mark-as-present/manga/<int:pk>/', | ||||
| @@ -21,15 +21,15 @@ urlpatterns = [ | ||||
|     path('mark-as-present/cd/<int:pk>/', | ||||
|          views.MarkCDAsPresent.as_view(), | ||||
|          name="mark_cd_as_present"), | ||||
|     path('mark-as-present/vinyle/<int:pk>/', | ||||
|     path('mark-as-present/vinyl/<int:pk>/', | ||||
|          views.MarkVinylAsPresent.as_view(), | ||||
|          name="mark_vinyle_as_present"), | ||||
|     path('mark-as-present/roman/<int:pk>/', | ||||
|          views.MarkRomanAsPresent.as_view(), | ||||
|          name="mark_roman_as_present"), | ||||
|     path('mark-as-present/revue/<int:pk>/', | ||||
|          views.MarkRevueAsPresent.as_view(), | ||||
|          name="mark_revue_as_present"), | ||||
|     path('mark-as-present/novel/<int:pk>/', | ||||
|          views.MarkNovelAsPresent.as_view(), | ||||
|          name="mark_novel_as_present"), | ||||
|     path('mark-as-present/review/<int:pk>/', | ||||
|          views.MarkReviewAsPresent.as_view(), | ||||
|          name="mark_review_as_present"), | ||||
|     path('mark-as-present/future/<int:pk>/', | ||||
|          views.MarkFutureAsPresent.as_view(), | ||||
|          name="mark_future_as_present"), | ||||
|   | ||||
| @@ -81,11 +81,11 @@ class MarkVinylAsPresent(MarkMediumAsPresent): | ||||
|     model = Vinyl | ||||
|  | ||||
|  | ||||
| class MarkRomanAsPresent(MarkMediumAsPresent): | ||||
| class MarkNovelAsPresent(MarkMediumAsPresent): | ||||
|     model = Novel | ||||
|  | ||||
|  | ||||
| class MarkRevueAsPresent(MarkMediumAsPresent): | ||||
| class MarkReviewAsPresent(MarkMediumAsPresent): | ||||
|     model = Review | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user