Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Only explicitly set the encoding of the form when set

Roland Geider304f5f78c5ba
diff --git a/wger/exercises/views/images.py b/wger/exercises/views/images.py
index 1f57e7dcc..d2289eb2c 100644
--- a/wger/exercises/views/images.py
+++ b/wger/exercises/views/images.py
@@ -55,6 +55,7 @@ class ExerciseImageEditView(WgerFormMixin, UpdateView, WgerPermissionMixin):
# Send some additional data to the template
def get_context_data(self, **kwargs):
context = super(ExerciseImageEditView, self).get_context_data(**kwargs)
+ context['enctype'] = 'multipart/form-data'
context['form_action'] = reverse('exerciseimage-edit',
kwargs={'pk': self.object.id})
@@ -83,6 +84,7 @@ class ExerciseImageAddView(WgerFormMixin, CreateView, WgerPermissionMixin):
Send some additional data to the template
'''
context = super(ExerciseImageAddView, self).get_context_data(**kwargs)
+ context['enctype'] = 'multipart/form-data'
context['form_action'] = reverse('exerciseimage-add',
kwargs={'exercise_pk': self.kwargs['exercise_pk']})
diff --git a/wger/manager/templates/form.html b/wger/manager/templates/form.html
index 10b66a39f..b66b5060c 100644
--- a/wger/manager/templates/form.html
+++ b/wger/manager/templates/form.html
@@ -26,7 +26,7 @@
-->
{% block content %}
<form action="{{form_action}}"
- enctype="multipart/form-data"
+ {% if enctype %}enctype="{{enctype}}"{% endif %}
method="post"
class="ym-form">
{% csrf_token %}