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.contrib.sites.admin import Site, SiteAdmin
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.views.decorators.cache import never_cache from django.views.decorators.cache import never_cache
from media.models import Emprunt from media.models import Emprunt

View File

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

View File

@ -41,7 +41,8 @@ class MediaAdminForm(ModelForm):
Download data from google books Download data from google books
:return True if success :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: with urllib.request.urlopen(api_url) as url:
data = json.loads(url.read().decode()) data = json.loads(url.read().decode())
@ -173,7 +174,8 @@ class MediaAdminForm(ModelForm):
if not scrap_result: if not scrap_result:
# Try with OpenLibrary # Try with OpenLibrary
if not self.download_data_openlibrary(isbn): 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 return self.cleaned_data
if self.cleaned_data['title']: if self.cleaned_data['title']: