mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-27 20:11:14 +00:00
Edit view for site settings
This commit is contained in:
parent
21aadf2920
commit
9db327a69e
3 changed files with 22 additions and 3 deletions
|
@ -90,6 +90,9 @@
|
|||
Import books
|
||||
</a>
|
||||
</li>
|
||||
{% if perms.bookwyrm.create_invites or perms.bookwyrm.edit_instance_settings%}
|
||||
<hr class="navbar-divider">
|
||||
{% endif %}
|
||||
{% if perms.bookwyrm.create_invites %}
|
||||
<li>
|
||||
<a href="{% url 'settings-invites' %}" class="navbar-item">
|
||||
|
@ -97,6 +100,13 @@
|
|||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if perms.bookwyrm.edit_instance_settings %}
|
||||
<li>
|
||||
<a href="{% url 'settings-site' %}" class="navbar-item">
|
||||
Site Configuration
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<hr class="navbar-divider">
|
||||
<li>
|
||||
<a href="/logout" class="navbar-item">
|
||||
|
|
|
@ -51,11 +51,11 @@
|
|||
<h2 class="title is-4">Footer Content</h2>
|
||||
<div class="control">
|
||||
<label class="label" for="id_support_link">Support link:</label>
|
||||
<input type="text" name="support_link" maxlength="255" class="input" id="id_support_link" placeholder="https://www.patreon.com/bookwyrm" value="{{ site.support_link }}">
|
||||
<input type="text" name="support_link" maxlength="255" class="input" id="id_support_link" placeholder="https://www.patreon.com/bookwyrm"{% if site.support_link %} value="{{ site.support_link }}"{% endif %}>
|
||||
</div>
|
||||
<div class="control">
|
||||
<label class="label" for="id_support_title">Support title:</label>
|
||||
<input type="text" name="support_title" maxlength="100" class="input" id="id_support_title" placeholder="Patreon" value="{{ site.support_title }}">
|
||||
<input type="text" name="support_title" maxlength="100" class="input" id="id_support_title" placeholder="Patreon"{% if site.support_title %} value="{{ site.support_title }}"{% endif %}>
|
||||
</div>
|
||||
<div class="control">
|
||||
<label class="label" for="id_admin_email">Admin email:</label>
|
||||
|
|
|
@ -27,5 +27,14 @@ class Site(View):
|
|||
|
||||
def post(self, request):
|
||||
''' edit the site settings '''
|
||||
site = models.SiteSettings.objects.get()
|
||||
form = forms.SiteForm(request.POST, instance=site)
|
||||
if not form.is_valid():
|
||||
data = {
|
||||
'title': 'Site Settings',
|
||||
'site_form': form
|
||||
}
|
||||
return TemplateResponse(request, 'settings/site.html', data)
|
||||
form.save()
|
||||
|
||||
return redirect('/settings/site-settings')
|
||||
return redirect('settings-site')
|
||||
|
|
Loading…
Reference in a new issue