Beispiel #1
0
    def clean(self, *args, **kwargs):
        url = super(OEmbedUrlField, self).clean(*args, **kwargs)

        if not backend.has_provider_for_url(url):
            raise ValidationError(_("The URL is not valid for embedding content"))  # or is not configured as provider.

        return url
Beispiel #2
0
    def clean(self, *args, **kwargs):
        url = super(OEmbedUrlField, self).clean(*args, **kwargs)

        if not backend.has_provider_for_url(url):
            # It's also possible that the backend is configured as provider.
            raise ValidationError(_("The URL is not valid for embedding content"))

        return url
    def clean_embed_url(self):
        """
        Validate the URL
        """
        url = self.cleaned_data['embed_url']
        if not backend.has_provider_for_url(url):
            raise ValidationError(_("The URL is not valid for embedding content"))  # or is not configured as provider.

        return url