mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 03:21:05 +00:00
Merge pull request #1952 from bookwyrm-social/settings
Fixes admin settings view
This commit is contained in:
commit
9eb798e932
3 changed files with 21 additions and 3 deletions
|
@ -440,7 +440,7 @@ class GoalForm(CustomForm):
|
||||||
class SiteForm(CustomForm):
|
class SiteForm(CustomForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.SiteSettings
|
model = models.SiteSettings
|
||||||
exclude = []
|
exclude = ["admin_code", "install_mode"]
|
||||||
widgets = {
|
widgets = {
|
||||||
"instance_short_description": forms.TextInput(
|
"instance_short_description": forms.TextInput(
|
||||||
attrs={"aria-describedby": "desc_instance_short_description"}
|
attrs={"aria-describedby": "desc_instance_short_description"}
|
||||||
|
|
|
@ -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