Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Remove more unused code

Roland Geider8d3fa66b1835
diff --git a/wger/exercises/urls.py b/wger/exercises/urls.py
index f3e74b0b3..268810745 100644
--- a/wger/exercises/urls.py
+++ b/wger/exercises/urls.py
@@ -27,12 +27,10 @@ from wger.core.views.react import ReactView
from wger.exercises.views import (
categories,
equipment,
- exercises,
history,
muscles,
)
-
# sub patterns for history
patterns_history = [
path('admin-control', history.control, name='overview'),
@@ -124,12 +122,7 @@ patterns_exercise = [
),
path(
'<int:id>/view/',
- exercises.view,
- name='view',
- ),
- re_path(
- r'^(?P<id>\d+)/view/(?P<slug>[-\w]*)/?$',
- exercises.view,
+ ReactView.as_view(div_id='react-exercise-detail'),
name='view',
),
path(
diff --git a/wger/exercises/views/exercises.py b/wger/exercises/views/exercises.py
deleted file mode 100644
index f662bc427..000000000
--- a/wger/exercises/views/exercises.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# This file is part of wger Workout Manager.
-#
-# wger Workout Manager is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# wger Workout Manager is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU Affero General Public License
-
-# Standard Library
-import logging
-
-# Django
-from django.contrib.auth.mixins import (
- LoginRequiredMixin,
- PermissionRequiredMixin,
-)
-from django.http import HttpResponsePermanentRedirect
-from django.shortcuts import get_object_or_404
-from django.urls import (
- reverse,
- reverse_lazy,
-)
-from django.utils.translation import (
- gettext as _,
- gettext_lazy,
-)
-from django.views.generic import DeleteView
-
-# wger
-from wger.exercises.models import Translation
-from wger.utils.generic_views import WgerDeleteMixin
-
-logger = logging.getLogger(__name__)
-
-
-def view(request, id, slug=None):
- """
- Detail view for an exercise translation
- """
- translation = get_object_or_404(Translation, pk=id)
-
- return HttpResponsePermanentRedirect(
- reverse(
- 'exercise:exercise:view-base', kwargs={'pk': translation.exercise_id, 'slug': slug}
- )
- )
-
-
-class ExerciseDeleteView(
- WgerDeleteMixin,
- LoginRequiredMixin,
- PermissionRequiredMixin,
- DeleteView,
-):
- """
- Generic view to delete an existing exercise
- """
-
- model = Translation
- success_url = reverse_lazy('exercise:exercise:overview')
- delete_message_extra = gettext_lazy('This will delete the exercise from all workouts.')
- messages = gettext_lazy('Successfully deleted')
- permission_required = 'exercises.delete_exercise'
-
- def get_context_data(self, **kwargs):
- """
- Send some additional data to the template
- """
- context = super(ExerciseDeleteView, self).get_context_data(**kwargs)
- context['title'] = _('Delete {0}?').format(self.object.name)
- return context