def clean(self):
        
        cleaned_data = self.cleaned_data
        
        model = self.toplevel_model
        
        relative_to = cleaned_data.get('relative_to')
        relative_position = cleaned_data.get('relative_position')
        
        if not self.instance.pk:
            
            if not relative_to:
                try:
                    model.objects.validate_root(None, relative_to, pos=relative_position, cleaned_data=cleaned_data)
                except EasyTreeException, e:
                    raise forms.ValidationError, e.message
            else:
                if ('last-child', 'first-child', 'sorted-child') in relative_position:
                    
                    try:
                        model.objects.validate_child(None, relative_to, pos=relative_position, cleaned_data=cleaned_data)
                    except EasyTreeException, e:
                        raise forms.ValidationError, e.message
                        
                else:
                    
                    try:
                        model.objects.validate_sibling(None, relative_to, pos=relative_position, cleaned_data=cleaned_data)
                    except EasyTreeException, e:
                        raise forms.ValidationError, e.message
                        
        else:
            if relative_to:
                try:
                    model.objects.validate_move(self.instance, relative_to, pos=relative_position, cleaned_data=cleaned_data)
                except EasyTreeException, e:
                    raise forms.ValidationError, e.message        
        
        cleaned_data['relative_to'] = relative_to
        
        return cleaned_data
dataset/ETHPy150Open fabiocorneti/django-easytree/easytree/forms.py/BaseEasyTreeForm.clean/swapped operands of `in`