当前位置: 首页>>代码示例>>Python>>正文


Python BlacklistedSlug.blocked方法代码示例

本文整理汇总了Python中addons.models.BlacklistedSlug.blocked方法的典型用法代码示例。如果您正苦于以下问题:Python BlacklistedSlug.blocked方法的具体用法?Python BlacklistedSlug.blocked怎么用?Python BlacklistedSlug.blocked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在addons.models.BlacklistedSlug的用法示例。


在下文中一共展示了BlacklistedSlug.blocked方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: clean_package_name

# 需要导入模块: from addons.models import BlacklistedSlug [as 别名]
# 或者: from addons.models.BlacklistedSlug import blocked [as 别名]
 def clean_package_name(self):
     slug = self.cleaned_data['package_name']
     slug_validator(slug, lower=False)
     if Addon.objects.filter(slug=slug).exists():
         raise forms.ValidationError(_('This slug is already in use.'))
     if BlacklistedSlug.blocked(slug):
         raise forms.ValidationError(_('The slug cannot be: %s.' % slug))
     return slug
开发者ID:chenba,项目名称:zamboni,代码行数:10,代码来源:forms.py

示例2: clean_package_name

# 需要导入模块: from addons.models import BlacklistedSlug [as 别名]
# 或者: from addons.models.BlacklistedSlug import blocked [as 别名]
 def clean_package_name(self):
     slug = self.cleaned_data["package_name"]
     if slugify(slug, ok="_", lower=False, delimiter="_") != slug:
         raise forms.ValidationError(
             _("Enter a valid package name consisting of letters, numbers, " "or underscores.")
         )
     if Addon.objects.filter(slug=slug).exists():
         raise forms.ValidationError(_("This package name is already in use."))
     if BlacklistedSlug.blocked(slug):
         raise forms.ValidationError(_(u"The package name cannot be: %s." % slug))
     return slug
开发者ID:nearlyfreeapps,项目名称:olympia,代码行数:13,代码来源:forms.py

示例3: clean_slug

# 需要导入模块: from addons.models import BlacklistedSlug [as 别名]
# 或者: from addons.models.BlacklistedSlug import blocked [as 别名]
    def clean_slug(self):
        target = self.cleaned_data['slug']
        slug_validator(target, lower=False)

        if target != self.instance.slug:
            if Addon.objects.filter(slug=target).exists():
                raise forms.ValidationError(_('This slug is already in use.'))

            if BlacklistedSlug.blocked(target):
                raise forms.ValidationError(_('The slug cannot be: %s.'
                                              % target))
        return target
开发者ID:MechanisM,项目名称:zamboni,代码行数:14,代码来源:forms.py

示例4: clean_slug

# 需要导入模块: from addons.models import BlacklistedSlug [as 别名]
# 或者: from addons.models.BlacklistedSlug import blocked [as 别名]
def clean_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 BlacklistedSlug.blocked(slug):
            raise forms.ValidationError(
                _('The slug cannot be "%s". Please choose another.' % slug))

    return slug
开发者ID:magopian,项目名称:olympia,代码行数:14,代码来源:forms.py

示例5: clean_slug

# 需要导入模块: from addons.models import BlacklistedSlug [as 别名]
# 或者: from addons.models.BlacklistedSlug import blocked [as 别名]
    def clean_slug(self):
        target = self.cleaned_data["slug"]
        slug_validator(target, lower=False)
        slug_field = "app_slug" if self.instance.is_webapp() else "slug"

        if target != getattr(self.instance, slug_field):
            if Addon.objects.filter(**{slug_field: target}).exists():
                raise forms.ValidationError(_("This slug is already in use."))

            if BlacklistedSlug.blocked(target):
                raise forms.ValidationError(_("The slug cannot be: %s." % target))
        return target
开发者ID:bearstech,项目名称:zamboni,代码行数:14,代码来源:forms.py

示例6: clean_slug

# 需要导入模块: from addons.models import BlacklistedSlug [as 别名]
# 或者: from addons.models.BlacklistedSlug import blocked [as 别名]
def clean_slug(slug, instance):
    slug_validator(slug, lower=False)
    slug_field = 'app_slug' if instance.is_webapp() else 'slug'

    if slug != getattr(instance, slug_field):
        if Addon.objects.filter(**{slug_field: slug}).exists():
            raise forms.ValidationError(
                _('This slug is already in use. Please choose another.'))
        if BlacklistedSlug.blocked(slug):
            raise forms.ValidationError(
                _('The slug cannot be "%s". Please choose another.' % slug))

    return slug
开发者ID:KryDos,项目名称:zamboni,代码行数:15,代码来源:forms.py

示例7: clean_app_slug

# 需要导入模块: from addons.models import BlacklistedSlug [as 别名]
# 或者: from addons.models.BlacklistedSlug import blocked [as 别名]
    def clean_app_slug(self):
        slug_field = 'app_slug'
        target = self.cleaned_data[slug_field]
        slug_validator(target, lower=False)

        if target != getattr(self.instance, slug_field):
            if Addon.objects.filter(**{slug_field: target}).exists():
                raise forms.ValidationError(_('This slug is already in use.'))

            if BlacklistedSlug.blocked(target):
                raise forms.ValidationError(
                    _('The slug cannot be %s.' % target))
        return target
开发者ID:bearstech,项目名称:zamboni,代码行数:15,代码来源:forms.py


注:本文中的addons.models.BlacklistedSlug.blocked方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。