本文整理汇总了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())
示例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})
示例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})
示例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())
示例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, })
示例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]))
示例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})
示例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, })
示例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]))
示例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)
示例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})