admin: fix source creation view

This commit is contained in:
Jens Langhammer 2018-11-26 18:22:22 +01:00
parent 6c0e7b9741
commit 08a5c98823
3 changed files with 7 additions and 1 deletions

View file

View file

@ -0,0 +1,6 @@
"""passbook core source form fields"""
# from django import forms
SOURCE_FORM_FIELDS = ['name', 'slug', 'enabled']
# class SourceForm(forms.Form)

View file

@ -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)