Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Exclude 'exercise' field from form, so no need to add hidden field

Roland Geider01dcc0ad8bbb
diff --git a/manager/templates/exercise/view.html b/manager/templates/exercise/view.html
index 3de4fa810..6becd9992 100644
--- a/manager/templates/exercise/view.html
+++ b/manager/templates/exercise/view.html
@@ -20,9 +20,6 @@
<p>{% trans "All comments for this exercise" %}</p>
<form action="/exercise/view/{{ exercise.id }}" method="post">
-<div style="display:none">
- <input type="hidden" value="{{ exercise.id }}" name="exercise">
-</div>
{% csrf_token %}
{{ comment_form.as_p }}
<input type="submit" value="Submit" />
diff --git a/manager/views.py b/manager/views.py
index de77fbdbf..19b48ab5e 100644
--- a/manager/views.py
+++ b/manager/views.py
@@ -90,6 +90,7 @@ def add_step_4(request):
class ExerciseCommentForm(ModelForm):
class Meta:
model = ExerciseComment
+ exclude=('exercise',)
def exercise_overview(request):
"""Overview with all exercises
@@ -134,7 +135,7 @@ def exercise_view(request, id):
new_comment.save()
return HttpResponseRedirect('/exercise/view/%s' % id)
else:
- comment_form = WorkoutForm()
+ comment_form = ExerciseCommentForm()
template_data['comment_form'] = comment_form