Merge branch 'main' into production

This commit is contained in:
Mouse Reeve 2021-05-21 07:37:17 -07:00
commit 832a9494b1
3 changed files with 12 additions and 4 deletions

View file

@ -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 @@
</p>
<p>
<label class="label" for="id_event_date">Event date:</label>
<input type="date" name="event_date" value="{{ form.event_date.value }}" class="input" id="id_event_date">
<input type="date" name="event_date" value="{{ form.event_date.value|date:'Y-m-d' }}" class="input" id="id_event_date">
{% for error in form.event_date.errors %}
<p class="help is-danger">{{ error | escape }}</p>
{% endfor %}
@ -34,7 +38,7 @@
<div class="column">
<p>
<label class="label" for="id_start_date">Start date:</label>
<input type="date" name="start_date" class="input" id="id_start_date">
<input type="date" name="start_date" class="input" value="{{ form.start_date.value|date:'Y-m-d' }}" id="id_start_date">
{% for error in form.start_date.errors %}
<p class="help is-danger">{{ error | escape }}</p>
{% endfor %}
@ -43,7 +47,7 @@
<div class="column">
<p>
<label class="label" for="id_end_date">End date:</label>
<input type="date" name="end_date" class="input" id="id_end_date">
<input type="date" name="end_date" class="input" id="id_end_date" value="{{ form.end_date.value|date:'Y-m-d' }}">
{% for error in form.end_date.errors %}
<p class="help is-danger">{{ error | escape }}</p>
{% endfor %}

View file

@ -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,

View file

@ -81,7 +81,10 @@ class ImportStatus(View):
job = models.ImportJob.objects.get(id=job_id)
if job.user != request.user:
raise PermissionDenied
try:
task = app.AsyncResult(job.task_id)
except ValueError:
task = None
items = job.items.order_by("index").all()
failed_items = [i for i in items if i.fail_reason]
items = [i for i in items if not i.fail_reason]