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

        manager = Service.objects
        if 'instance' in kwargs:
            instance = kwargs['instance']
            manager = manager.exclude(Q(parent=instance) & Q(pk=instance.id))
        self.fields['parent'].queryset = Object.filter_permitted(
            user, manager, mode='x')

        self.fields['name'].label = _("Name")
        self.fields['parent'].label = _("Parent")
        self.fields['details'].label = _("Details")
Sets allowed values
dataset/ETHPy150Open treeio/treeio/treeio/services/forms.py/ServiceForm.__init__