本文整理汇总了Python中amo.forms.AbuseForm类的典型用法代码示例。如果您正苦于以下问题:Python AbuseForm类的具体用法?Python AbuseForm怎么用?Python AbuseForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AbuseForm类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: report_abuse
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
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
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
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
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
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
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
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
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
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
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})