Merge pull request #739 from mouse-reeve/site-images

Fixes upload and display of logos in admin panel
This commit is contained in:
Mouse Reeve 2021-03-15 10:26:58 -07:00 committed by GitHub
commit 8396785a49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View file

@ -7,7 +7,7 @@
{% block panel %}
<form action="{% url 'settings-site' %}" method="POST" class="content">
<form action="{% url 'settings-site' %}" method="POST" class="content" enctype="multipart/form-data">
{% csrf_token %}
<section class="block" id="instance-info">
<h2 class="title is-4">{% trans "Instance Info" %}</h2>

View file

@ -1,7 +1,7 @@
<div class="columns">
<div class="column is-narrow is-hidden-mobile">
<figure class="block">
<img src="{% if site.logo_small %}/images/{{ site.logo }}{% else %}/static/images/logo.png{% endif %}" alt="BookWyrm logo">
<img src="{% if site.logo %}/images/{{ site.logo }}{% else %}/static/images/logo.png{% endif %}" alt="BookWyrm logo">
</figure>
</div>
<div class="content">

View file

@ -26,7 +26,7 @@ class Site(View):
def post(self, request):
""" edit the site settings """
site = models.SiteSettings.objects.get()
form = forms.SiteForm(request.POST, instance=site)
form = forms.SiteForm(request.POST, request.FILES, instance=site)
if not form.is_valid():
data = {"site_form": form}
return TemplateResponse(request, "settings/site.html", data)