flows: fix error clearing flow background when no files have been uploaded
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
82b2c7e3f0
commit
afb84c7bc5
|
@ -3,16 +3,6 @@
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block head %}
|
|
||||||
{{ block.super }}
|
|
||||||
<style>
|
|
||||||
.pf-c-background-image::before {
|
|
||||||
background-image: url("{% static 'dist/assets/images/flow_background.jpg' %}");
|
|
||||||
background-position: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{% trans 'End session' %} - {{ tenant.branding_title }}
|
{% trans 'End session' %} - {{ tenant.branding_title }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -303,8 +303,12 @@ class FlowViewSet(UsedByMixin, ModelViewSet):
|
||||||
background = request.FILES.get("file", None)
|
background = request.FILES.get("file", None)
|
||||||
clear = request.data.get("clear", False)
|
clear = request.data.get("clear", False)
|
||||||
if clear:
|
if clear:
|
||||||
|
if flow.background_url.startswith("/media"):
|
||||||
# .delete() saves the model by default
|
# .delete() saves the model by default
|
||||||
flow.background.delete()
|
flow.background.delete()
|
||||||
|
else:
|
||||||
|
flow.background = None
|
||||||
|
flow.save()
|
||||||
return Response({})
|
return Response({})
|
||||||
if background:
|
if background:
|
||||||
flow.background = background
|
flow.background = background
|
||||||
|
|
Reference in New Issue