

def __init__(self, *args, **kwargs):
    super(ServiceForm, self).__init__(*args, **kwargs)
    autocompletes = ['category', 'business_owner', 'tech_owner', 'used_by']
    for ac in autocompletes:
        data = list(Service.objects.all().order_by(ac).distinct().values_list(ac, flat=True))
        try:
            data.remove('')
        except ValueError:
            pass
        self.fields[ac].widget.attrs['class'] = 'service-auto-complete'
        self.fields[ac].widget.attrs['data-autocomplete'] = json.dumps(data)
    self.fields['systems'].widget.attrs['class'] = 'chosen-select'
    self.fields['site'].widget.attrs['class'] = 'chosen-select'
    self.fields['parent_service'].widget.attrs['class'] = 'chosen-select'
    self.fields['depends_on'].widget.attrs['class'] = 'chosen-select'
    self.fields['allocations'].widget.attrs['class'] = 'chosen-select service-allocations'
    if self.instance.pk:
        self.fields['parent_service'].queryset = Service.objects.exclude(pk=self.instance.pk)

dataset/ETHPy150Open mozilla/inventory/core/service/forms.py ServiceForm.__init__/original