Commit 53f1b2de by Zia Fazal

fix for organization id drop down not populating

parent 3bf6b9bd
......@@ -18,10 +18,14 @@ class CertificateTemplateForm(forms.ModelForm):
"""
Django admin form for CertificateTemplate model
"""
organizations = get_organizations()
org_choices = [(org["id"], org["name"]) for org in organizations]
org_choices.insert(0, ('', 'None'))
organization_id = forms.TypedChoiceField(choices=org_choices, required=False, coerce=int, empty_value=None)
def __init__(self, *args, **kwargs):
super(CertificateTemplateForm, self).__init__(*args, **kwargs)
organizations = get_organizations()
org_choices = [(org["id"], org["name"]) for org in organizations]
org_choices.insert(0, ('', 'None'))
self.fields['organization_id'] = forms.TypedChoiceField(
choices=org_choices, required=False, coerce=int, empty_value=None
)
class Meta(object):
""" Meta definitions for CertificateTemplateForm """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment