1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2024-12-26 04:22:24 +00:00

Fix linters

This commit is contained in:
Yohann D'ANELLO 2020-05-12 17:34:53 +02:00
parent ea30cdec6e
commit 1c8d5750bb
3 changed files with 5 additions and 4 deletions

View File

@ -7,7 +7,6 @@ from django.contrib.auth.admin import Group, GroupAdmin
from django.contrib.sites.admin import Site, SiteAdmin
from django.utils.translation import gettext_lazy as _
from django.views.decorators.cache import never_cache
from media.models import Emprunt

View File

@ -9,7 +9,7 @@ from reversion.admin import VersionAdmin
from med.admin import admin_site
from .forms import MediaAdminForm
from .models import Auteur, Emprunt, Jeu, Media, FutureMedia
from .models import Auteur, Emprunt, FutureMedia, Jeu, Media
class AuteurAdmin(VersionAdmin):

View File

@ -41,7 +41,8 @@ class MediaAdminForm(ModelForm):
Download data from google books
:return True if success
"""
api_url = "https://www.googleapis.com/books/v1/volumes?q=ISBN:{}".format(isbn)
api_url = "https://www.googleapis.com/books/v1/volumes?q=ISBN:{}"\
.format(isbn)
with urllib.request.urlopen(api_url) as url:
data = json.loads(url.read().decode())
@ -173,7 +174,8 @@ class MediaAdminForm(ModelForm):
if not scrap_result:
# Try with OpenLibrary
if not self.download_data_openlibrary(isbn):
self.add_error('isbn', _("This ISBN is not found."))
self.add_error('isbn',
_("This ISBN is not found."))
return self.cleaned_data
if self.cleaned_data['title']: