From 2a2afb061ee838ca5a97fc0749685221003bf4f0 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Thu, 15 Aug 2019 16:30:44 +0200 Subject: [PATCH] Fix isbn widget --- TODO | 2 ++ media/forms.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 TODO diff --git a/TODO b/TODO new file mode 100644 index 0000000..5b3e923 --- /dev/null +++ b/TODO @@ -0,0 +1,2 @@ +régler pq de permission sur app sporz : permettre d'afficher seulement nos gamesave à tout le monde + diff --git a/media/forms.py b/media/forms.py index 94c64c6..6630da6 100644 --- a/media/forms.py +++ b/media/forms.py @@ -19,8 +19,10 @@ class EmpruntForm(ModelForm): class MediaAdminForm(ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.fields['isbn'].widget.template_name = "media/isbn_button.html" - self.fields['isbn'].widget.attrs.update({'autofocus': 'autofocus'}) + isbn_field = self.fields.get('isbn') + if isbn_field: + isbn_field.widget.template_name = "media/isbn_button.html" + isbn_field.widget.attrs.update({'autofocus': 'autofocus'}) def download_data(self, isbn): """