def clean_addon_slug(slug, instance): slug_validator(slug, lower=False) if slug != instance.slug: if Addon.objects.filter(slug=slug).exists(): raise forms.ValidationError( _('This slug is already in use. Please choose another.')) if DeniedSlug.blocked(slug): raise forms.ValidationError( _('The slug cannot be "%s". Please choose another.' % slug)) return slug
def clean_addon_slug(slug, instance): slug_validator(slug, lower=False) if slug != instance.slug: if Addon.objects.filter(slug=slug).exists(): raise forms.ValidationError(ugettext( 'This slug is already in use. Please choose another.')) if DeniedSlug.blocked(slug): msg = ugettext(u'The slug cannot be "%(slug)s". ' u'Please choose another.') raise forms.ValidationError(msg % {'slug': slug}) return slug