From c70e1651a6ad07afdd86ede41f859233ebe80fee Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 26 Sep 2017 16:35:18 +0200 Subject: Can create only an importer of only an available importer type --- ishtar_common/forms_common.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ishtar_common/forms_common.py') diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 42e390925..116c8c277 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -123,6 +123,11 @@ class NewImportForm(forms.ModelForm): else: self.fields['associated_group'].choices = [(None, '--')] + \ [(g.pk, unicode(g)) for g in groups.all()] + self.fields['importer_type'].choices = [('', '--')] + [ + (imp.pk, imp.name) for imp in models.ImporterType.objects.filter( + available=True + ) + ] def clean(self): data = self.cleaned_data -- cgit v1.2.3