From 08a5c98823bcc9eead8c462ac1ad65a1c07dbed8 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 26 Nov 2018 18:22:22 +0100 Subject: [PATCH] admin: fix source creation view --- passbook/admin/forms/__init__.py | 0 passbook/admin/forms/source.py | 6 ++++++ passbook/admin/views/sources.py | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 passbook/admin/forms/__init__.py create mode 100644 passbook/admin/forms/source.py diff --git a/passbook/admin/forms/__init__.py b/passbook/admin/forms/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/passbook/admin/forms/source.py b/passbook/admin/forms/source.py new file mode 100644 index 000000000..25052bb4a --- /dev/null +++ b/passbook/admin/forms/source.py @@ -0,0 +1,6 @@ +"""passbook core source form fields""" +# from django import forms + +SOURCE_FORM_FIELDS = ['name', 'slug', 'enabled'] + +# class SourceForm(forms.Form) diff --git a/passbook/admin/views/sources.py b/passbook/admin/views/sources.py index b922b70ae..288b133ca 100644 --- a/passbook/admin/views/sources.py +++ b/passbook/admin/views/sources.py @@ -31,7 +31,7 @@ class SourceCreateView(SuccessMessageMixin, AdminRequiredMixin, CreateView): def get_form_class(self): source_type = self.request.GET.get('type') - model = next(x if x.__name__ == source_type else None for x in Source.__subclasses__()) + model = next(x for x in Source.__subclasses__() if x.__name__ == source_type) if not model: raise Http404 return path_to_class(model.form)