def clean_domain(self):
        domain = self.cleaned_data.get('domain')

        if domain:
            if Site.objects.filter(domain=domain).exists():
                return domain
            else:
                raise forms.ValidationError(
                    _("site with domain %s does not exist") % domain
                )
        else:
            raise forms.ValidationError(_("domain not provided"))
dataset/ETHPy150Open c4all/c4all/comments/forms.py/PostCommentForm.clean_domain/original