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


Python AbuseForm.is_valid方法代码示例

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


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

示例1: report_abuse

# 需要导入模块: from amo.forms import AbuseForm [as 别名]
# 或者: from amo.forms.AbuseForm import is_valid [as 别名]
def report_abuse(request, user):
    form = AbuseForm(request.POST or None, request=request)
    if request.method == "POST" and form.is_valid():
        send_abuse_report(request, user, form.cleaned_data["text"])
        messages.success(request, _("User reported."))
    else:
        return jingo.render(request, "users/report_abuse_full.html", {"profile": user, "abuse_form": form})
    return redirect(user.get_url_path())
开发者ID:hardikj,项目名称:zamboni,代码行数:10,代码来源:views.py

示例2: abuse_recaptcha

# 需要导入模块: from amo.forms import AbuseForm [as 别名]
# 或者: from amo.forms.AbuseForm import is_valid [as 别名]
def abuse_recaptcha(request, addon):
    form = AbuseForm(request.POST or None, request=request)
    if request.method == "POST" and form.is_valid():
        send_abuse_report(request, addon, form.cleaned_data["text"])
        messages.success(request, _("Abuse reported."))
        return redirect(addon.get_url_path())
    else:
        return jingo.render(request, "detail/abuse_recaptcha.html", {"product": addon, "abuse_form": form})
开发者ID:dbialer,项目名称:zamboni,代码行数:10,代码来源:views.py

示例3: report_abuse

# 需要导入模块: from amo.forms import AbuseForm [as 别名]
# 或者: from amo.forms.AbuseForm import is_valid [as 别名]
def report_abuse(request, addon):
    form = AbuseForm(request.POST or None, request=request)
    if request.method == "POST" and form.is_valid():
        send_abuse_report(request, addon, form.cleaned_data["text"])
        messages.success(request, _("Abuse reported."))
        return http.HttpResponseRedirect(addon.get_url_path())
    else:
        return render(request, "addons/report_abuse_full.html", {"addon": addon, "abuse_form": form})
开发者ID:BavarianTomcat,项目名称:olympia,代码行数:10,代码来源:views.py

示例4: report_abuse

# 需要导入模块: from amo.forms import AbuseForm [as 别名]
# 或者: from amo.forms.AbuseForm import is_valid [as 别名]
def report_abuse(request, user):
    form = AbuseForm(request.POST or None, request=request)
    if request.method == 'POST' and form.is_valid():
        send_abuse_report(request, user, form.cleaned_data['text'])
        messages.success(request, _('User reported.'))
    else:
        return jingo.render(request, 'users/report_abuse_full.html',
                            {'profile': user, 'abuse_form': form, })
    return redirect(user.get_url_path())
开发者ID:steekid,项目名称:zamboni,代码行数:11,代码来源:views.py

示例5: report_abuse

# 需要导入模块: from amo.forms import AbuseForm [as 别名]
# 或者: from amo.forms.AbuseForm import is_valid [as 别名]
def report_abuse(request, addon):
    form = AbuseForm(request.POST or None, request=request)
    if request.method == "POST" and form.is_valid():
        send_abuse_report(request, addon, form.cleaned_data['text'])
        messages.success(request, _('Abuse reported.'))
        return http.HttpResponseRedirect(addon.get_url_path())
    else:
        return jingo.render(request, 'addons/report_abuse_full.html',
                            {'addon': addon, 'abuse_form': form, })
开发者ID:jvillalobos,项目名称:zamboni,代码行数:11,代码来源:views.py

示例6: report_abuse

# 需要导入模块: from amo.forms import AbuseForm [as 别名]
# 或者: from amo.forms.AbuseForm import is_valid [as 别名]
def report_abuse(request, user_id):
    user = get_object_or_404(UserProfile, pk=user_id)
    form = AbuseForm(request.POST or None, request=request)
    if request.method == "POST" and form.is_valid():
        send_abuse_report(request, user, form.cleaned_data["text"])
        messages.success(request, _("User reported."))
    else:
        return jingo.render(request, "users/report_abuse_full.html", {"profile": user, "abuse_form": form})
    return redirect(reverse("users.profile", args=[user.pk]))
开发者ID:dbialer,项目名称:zamboni,代码行数:11,代码来源:views.py

示例7: abuse_recaptcha

# 需要导入模块: from amo.forms import AbuseForm [as 别名]
# 或者: from amo.forms.AbuseForm import is_valid [as 别名]
def abuse_recaptcha(request, addon):
    form = AbuseForm(request.POST or None, request=request)
    if request.method == 'POST' and form.is_valid():
        send_abuse_report(request, addon, form.cleaned_data['text'])
        messages.success(request, _('Abuse reported.'))
        return redirect(addon.get_url_path())
    else:
        return jingo.render(request, 'detail/abuse_recaptcha.html',
                            {'product': addon, 'abuse_form': form})
开发者ID:gkoberger,项目名称:zamboni,代码行数:11,代码来源:views.py

示例8: report_abuse

# 需要导入模块: from amo.forms import AbuseForm [as 别名]
# 或者: from amo.forms.AbuseForm import is_valid [as 别名]
def report_abuse(request, addon):
    form = AbuseForm(request.POST or None, request=request)
    if request.method == "POST" and form.is_valid():
        send_abuse_report(request, addon, form.cleaned_data['text'])
        messages.success(request, _('Abuse reported.'))
        return redirect('addons.detail', addon.slug)
    else:
        return jingo.render(request, 'addons/report_abuse_full.html',
                            {'addon': addon, 'abuse_form': form, })
开发者ID:MechanisM,项目名称:zamboni,代码行数:11,代码来源:views.py

示例9: report_abuse

# 需要导入模块: from amo.forms import AbuseForm [as 别名]
# 或者: from amo.forms.AbuseForm import is_valid [as 别名]
def report_abuse(request, user_id):
    user = get_object_or_404(UserProfile, pk=user_id)
    form = AbuseForm(request.POST or None, request=request)
    if request.method == 'POST' and form.is_valid():
        send_abuse_report(request, user, form.cleaned_data['text'])
        messages.success(request, _('User reported.'))
    else:
        return jingo.render(request, 'users/report_abuse_full.html',
                            {'profile': user, 'abuse_form': form, })
    return redirect(reverse('users.profile', args=[user.pk]))
开发者ID:dimonov,项目名称:zamboni,代码行数:12,代码来源:views.py

示例10: report_abuse

# 需要导入模块: from amo.forms import AbuseForm [as 别名]
# 或者: from amo.forms.AbuseForm import is_valid [as 别名]
def report_abuse(request, addon):
    if not settings.REPORT_ABUSE:
        raise http.Http404()

    form = AbuseForm(request.POST or None, request=request)
    if request.method == "POST" and form.is_valid():
        url = reverse('addons.detail', args=[addon.slug])
        send_abuse_report(request, addon, url, form.cleaned_data['text'])
        messages.success(request, _('Abuse reported.'))
    else:
        return jingo.render(request, 'addons/report_abuse_full.html',
                            {'addon': addon, 'abuse_form': form, })
    return redirect('addons.detail', addon.slug)
开发者ID:LittleForker,项目名称:zamboni,代码行数:15,代码来源:views.py

示例11: abuse

# 需要导入模块: from amo.forms import AbuseForm [as 别名]
# 或者: from amo.forms.AbuseForm import is_valid [as 别名]
def abuse(request, user_id):
    user = get_object_or_404(UserProfile, pk=user_id)
    form = AbuseForm(request.POST or None, request=request)
    if request.method == 'POST' and form.is_valid():
        send_abuse_report(request, user, form.cleaned_data['text'])
        messages.success(request, _('Abuse reported.'))
        # We don't have a profile page to redirect back to. Once the abuse
        # is reported, that would be the place I'd recommend redirecting
        # back to.
        return redirect('/')
    else:
        return jingo.render(request, 'account/abuse.html',
                            {'user': user, 'abuse_form': form})
开发者ID:lauraxt,项目名称:zamboni,代码行数:15,代码来源:views.py


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