From a70c713c29ffcc3b8e877237f28b608edbd7e822 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 20 May 2021 20:21:04 -0700 Subject: [PATCH] Fixes default values in edit announcement form --- bookwyrm/templates/settings/announcement_form.html | 10 +++++++--- bookwyrm/views/announcements.py | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bookwyrm/templates/settings/announcement_form.html b/bookwyrm/templates/settings/announcement_form.html index 4e2e8f32d..8eb6acd52 100644 --- a/bookwyrm/templates/settings/announcement_form.html +++ b/bookwyrm/templates/settings/announcement_form.html @@ -2,7 +2,11 @@ {% load i18n %} {% block header %} +{% if announcement %} +{% trans "Edit Announcement" %} +{% else %} {% trans "Create Announcement" %} +{% endif %} {% endblock %} {% block form %} @@ -24,7 +28,7 @@

- + {% for error in form.event_date.errors %}

{{ error | escape }}

{% endfor %} @@ -34,7 +38,7 @@

- + {% for error in form.start_date.errors %}

{{ error | escape }}

{% endfor %} @@ -43,7 +47,7 @@

- + {% for error in form.end_date.errors %}

{{ error | escape }}

{% endfor %} diff --git a/bookwyrm/views/announcements.py b/bookwyrm/views/announcements.py index 6cd6ecd8f..e522fc7f6 100644 --- a/bookwyrm/views/announcements.py +++ b/bookwyrm/views/announcements.py @@ -81,6 +81,7 @@ class Announcement(View): form = forms.AnnouncementForm(request.POST, instance=announcement) if form.is_valid(): announcement = form.save() + form = forms.AnnouncementForm(instance=announcement) data = { "announcement": announcement, "form": form,