Self hosted FLOSS fitness/workout, nutrition and weight tracker
Remove exercise_edit method
Roland Geiderc679440f7afd
diff --git a/exercises/views.py b/exercises/views.pyindex 895721c40..8d8414663 100644--- a/exercises/views.py+++ b/exercises/views.py@@ -270,83 +270,6 @@ class ExerciseAddView(ExercisesCreateView):class ExerciseDeleteView(ExercisesDeleteView):model = Exercise---@permission_required('exercises.change_exercise')-def exercise_edit(request, id=None):-- # Define the exercise form here because only at this point during the request have we access to- # the currently used language. In other places Django defaults to 'en-us'. Since we only use it- # here, it's OK- class ExerciseForm(ModelForm):- language = load_language()- category = ModelChoiceField(queryset=ExerciseCategory.objects.filter(language = language.id))-- class Meta:- model = Exercise-- template_data = {}- template_data.update(csrf(request))- template_data['active_tab'] = 'exercises'-- # If the object is new, we will receice a 'None' (string) as the ID- # from the template, so we check for it (ValueError) and for an actual- # None (TypeError)- try:- int(id)- exercise = get_object_or_404(Exercise, pk=id)- except ValueError, TypeError:- exercise = Exercise()-- template_data['exercise'] = exercise-- if request.method == 'POST':- exercise_form = ExerciseForm(request.POST, instance=exercise)-- # If the data is valid, save and redirect- if exercise_form.is_valid():- exercise = exercise_form.save()- id = exercise.id- return HttpResponseRedirect(reverse('exercises.views.exercise_view', kwargs= {'id': id}))- else:- exercise_form = ExerciseForm(instance=exercise)-- #template_data['edit_form'] = exercise_form-- #- # Pass settings to the form template- #- if exercise.id:- template_data['title'] = _('Edit %(exercisename)s') % {'exercisename': exercise.name}- else:- template_data['title'] = _('New exercise')-- template_data['form_action'] = reverse('exercises.views.exercise_edit',- kwargs = {'id': exercise.id})-- # Form fields are listed here, otherwise the order from the model is- # used. The list comprehension is to avoid weird problems with django's- # template when accessing the fields with "form.fieldname"- template_data['form_fields'] = [exercise_form[i] for i in [- 'name',- 'category',- 'muscles',- 'description'- ]- ]-- # Drop down lists get a special CSS class- template_data['select_lists'] = ['category']-- template_data['static_files'] = ['js/tinymce/tiny_mce.js',- 'js/workout-manager.js']-- # Custom JS code on form (autocompleter, editor, etc.)- template_data['custom_js'] = 'init_tinymce();'-- return render_to_response('form.html',- template_data,- context_instance=RequestContext(request))@permission_required('exercises.delete_exercise')def exercise_delete(request, id):