def __init__(self, *args, **kwargs):
        super(ServiceForm, self).__init__(*args, **kwargs)

        # Below are a list of fields in the form that will have data
        # autocomplete in them
        autocompletes = [
            'category',
            'business_owner',
            'tech_owner',
            'used_by',
        ]

        # Dynamically load the auto complete data and shove it in a css
        # attribute. Later, javascript will setup JQuery autocomplete.
        for ac in autocompletes:
            data = list(
                Service.objects.all()
                .order_by(ac)
                .distinct()
                .values_list(ac, flat=True)
            )

            try:
                # Don't display the empty value
                data.remove('')
            except __HOLE__:
                pass

            self.fields[ac].widget.attrs['class'] = 'service-auto-complete'
            self.fields[ac].widget.attrs['data-autocomplete'] = (
                json.dumps(data)
            )

        # Any field that needs to be a chosen-select box should define that
        # here
        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'
        )

        # exclude thyself from parent service selection
        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__