Fixes form for reporting users

This commit is contained in:
Mouse Reeve 2021-04-17 10:28:03 -07:00
parent 797c3a12c8
commit e0c16b21e9
3 changed files with 4 additions and 3 deletions

View file

@ -15,7 +15,9 @@
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="reporter" value="{{ reporter.id }}"> <input type="hidden" name="reporter" value="{{ reporter.id }}">
<input type="hidden" name="user" value="{{ user.id }}"> <input type="hidden" name="user" value="{{ user.id }}">
{% if status %}
<input type="hidden" name="statuses" value="{{ status.id }}"> <input type="hidden" name="statuses" value="{{ status.id }}">
{% endif %}
<section class="content"> <section class="content">
<p>{% blocktrans with site_name=site.name %}This report will be sent to {{ site_name }}'s moderators for review.{% endblocktrans %}</p> <p>{% blocktrans with site_name=site.name %}This report will be sent to {{ site_name }}'s moderators for review.{% endblocktrans %}</p>

View file

@ -13,7 +13,7 @@
<a href="/direct-messages/{{ user|username }}" class="button is-fullwidth is-small">{% trans "Send direct message" %}</a> <a href="/direct-messages/{{ user|username }}" class="button is-fullwidth is-small">{% trans "Send direct message" %}</a>
</li> </li>
<li role="menuitem"> <li role="menuitem">
{% include 'snippets/report_button.html' with user=status.user class="is-fullwidth" %} {% include 'snippets/report_button.html' with user=user class="is-fullwidth" %}
</li> </li>
<li role="menuitem"> <li role="menuitem">
{% include 'snippets/block_button.html' with user=user class="is-fullwidth" %} {% include 'snippets/block_button.html' with user=user class="is-fullwidth" %}

View file

@ -98,8 +98,7 @@ def make_report(request):
""" a user reports something """ """ a user reports something """
form = forms.ReportForm(request.POST) form = forms.ReportForm(request.POST)
if not form.is_valid(): if not form.is_valid():
print(form.errors) raise ValueError(form.errors)
return redirect(request.headers.get("Referer", "/"))
form.save() form.save()
return redirect(request.headers.get("Referer", "/")) return redirect(request.headers.get("Referer", "/"))