def __init__(self, user, *args, **kwargs):
        if not ('report' in kwargs and 'field_name' in kwargs):
            return
        report = kwargs.pop('report')
        field_name = kwargs.pop('field_name')
        super(FilterForm, self).__init__(*args, **kwargs)

        model = loads(report.model)

        self.report = report
        self.field_name = field_name

        classobj = model.get_class_object()
        field = classobj._meta.get_field_by_name(field_name)[0]
        # TODO: Provisions for ManyToMany fields
        self.fields['operand'] = forms.ChoiceField()
        if field.get_internal_type() == 'ForeignKey':
            self.fields['choice'] = forms.ModelChoiceField(queryset=Object.filter_permitted(user,
                                                                                            field.related.parent_model.objects.all(),
                                                                                            mode='x'))
            fc = (('is', 'is'), ('not', 'is not'))
        elif field.get_internal_type() == 'DateTimeField':
            self.fields['choice'] = forms.DateTimeField()
            self.fields['choice'].widget.attrs.update(
                {'class': 'datetimepicker'})
            fc = (('beforedatetime', 'before'), ('afterdatetime', 'after'))
        elif field.get_internal_type() == 'DateField':
            self.fields['choice'] = forms.DateField()
            self.fields['choice'].widget.attrs.update({'class': 'datepicker'})
            fc = (('beforedate', 'before'), (
                'afterdate', 'after'), ('on', 'on'))
        else:
            self.fields['choice'] = field.formfield()
            fc = (('is', 'is'), ('not', 'is not'))

        self.fields['operand'].choices = fc
        self.fields['operand'].label = ""
        self.fields['choice'].label = ""
        self.fields['choice'].help_text = ""
dataset/ETHPy150Open treeio/treeio/treeio/reports/forms.py/FilterForm.__init__/original