forked from mirrors/bookwyrm
Show error or success states
This commit is contained in:
parent
1aac665094
commit
edf3b61602
2 changed files with 20 additions and 2 deletions
|
@ -15,6 +15,24 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block panel %}
|
{% block panel %}
|
||||||
|
{% if success %}
|
||||||
|
<div class="notification is-success is-light">
|
||||||
|
<span class="icon icon-check" aria-hidden="true"></span>
|
||||||
|
<span>
|
||||||
|
{% trans "Settings saved" %}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if site_form.errors %}
|
||||||
|
<div class="notification is-danger is-light">
|
||||||
|
<span class="icon icon-x" aria-hidden="true"></span>
|
||||||
|
<span>
|
||||||
|
{% trans "Unable to save settings" %}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<form action="{% url 'settings-site' %}" method="POST" class="content" enctype="multipart/form-data">
|
<form action="{% url 'settings-site' %}" method="POST" class="content" enctype="multipart/form-data">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<section class="block" id="instance_info">
|
<section class="block" id="instance_info">
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
""" manage site settings """
|
""" manage site settings """
|
||||||
from django.contrib.auth.decorators import login_required, permission_required
|
from django.contrib.auth.decorators import login_required, permission_required
|
||||||
from django.shortcuts import redirect
|
|
||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
from django.views import View
|
from django.views import View
|
||||||
|
@ -32,7 +31,8 @@ class Site(View):
|
||||||
return TemplateResponse(request, "settings/site.html", data)
|
return TemplateResponse(request, "settings/site.html", data)
|
||||||
form.save()
|
form.save()
|
||||||
|
|
||||||
return redirect("settings-site")
|
data = {"site_form": forms.SiteForm(instance=site), "success": True}
|
||||||
|
return TemplateResponse(request, "settings/site.html", data)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
|
Loading…
Reference in a new issue