mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-25 19:11:09 +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 Meta:
|
||||
model = models.SiteSettings
|
||||
exclude = []
|
||||
exclude = ["admin_code", "install_mode"]
|
||||
widgets = {
|
||||
"instance_short_description": forms.TextInput(
|
||||
attrs={"aria-describedby": "desc_instance_short_description"}
|
||||
|
|
|
@ -15,6 +15,24 @@
|
|||
{% endblock %}
|
||||
|
||||
{% 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">
|
||||
{% csrf_token %}
|
||||
<section class="block" id="instance_info">
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
""" manage site settings """
|
||||
from django.contrib.auth.decorators import login_required, permission_required
|
||||
from django.shortcuts import redirect
|
||||
from django.template.response import TemplateResponse
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views import View
|
||||
|
@ -32,7 +31,8 @@ class Site(View):
|
|||
return TemplateResponse(request, "settings/site.html", data)
|
||||
form.save()
|
||||
|
||||
return redirect("settings-site")
|
||||
data = {"site_form": forms.SiteForm(instance=site), "success": True}
|
||||
return TemplateResponse(request, "settings/site.html", data)
|
||||
|
||||
|
||||
@login_required
|
||||
|
|
Loading…
Reference in a new issue