From 9830c02bd9ed3ee57272ae8da8beee8751880b9a Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Tue, 24 Aug 2021 15:13:31 +0200
Subject: [PATCH] unused code removed

---
 smash/web/forms/__init__.py         |  4 ++--
 smash/web/forms/appointment_form.py | 14 ++++----------
 smash/web/urls.py                   |  4 +---
 smash/web/views/appointment.py      |  9 +--------
 4 files changed, 8 insertions(+), 23 deletions(-)

diff --git a/smash/web/forms/__init__.py b/smash/web/forms/__init__.py
index e637d7ad..186bda3c 100644
--- a/smash/web/forms/__init__.py
+++ b/smash/web/forms/__init__.py
@@ -5,14 +5,14 @@ from .forms import VisitDetailForm, \
     VisitAddForm, KitRequestForm, StatisticsForm, AvailabilityAddForm, \
     AvailabilityEditForm, HolidayAddForm
 from .contact_attempt_forms import ContactAttemptAddForm, ContactAttemptEditForm
-from .appointment_form import AppointmentDetailForm, AppointmentEditForm, AppointmentAddForm
+from .appointment_form import AppointmentEditForm, AppointmentAddForm
 from .study_subject_forms import StudySubjectAddForm, StudySubjectDetailForm, StudySubjectEditForm
 from .subject_forms import SubjectAddForm, SubjectEditForm, SubjectDetailForm
 from .voucher_forms import VoucherTypeForm, VoucherTypePriceForm, VoucherForm
 from .privacy_notice import PrivacyNoticeForm
 
 __all__ = [StudySubjectAddForm, StudySubjectDetailForm, StudySubjectEditForm, WorkerForm,
-           AppointmentDetailForm, AppointmentEditForm, AppointmentAddForm, VisitDetailForm, VisitAddForm,
+           AppointmentEditForm, AppointmentAddForm, VisitDetailForm, VisitAddForm,
            ContactAttemptAddForm, ContactAttemptEditForm, KitRequestForm, StatisticsForm, AvailabilityAddForm,
            AvailabilityEditForm, HolidayAddForm, SubjectAddForm, SubjectEditForm, SubjectDetailForm, VoucherTypeForm,
            VoucherTypePriceForm, VoucherForm, StudyEditForm, StudyNotificationParametersEditForm, StudyColumnsEditForm,
diff --git a/smash/web/forms/appointment_form.py b/smash/web/forms/appointment_form.py
index 333c302b..d55a2f1e 100644
--- a/smash/web/forms/appointment_form.py
+++ b/smash/web/forms/appointment_form.py
@@ -38,13 +38,13 @@ class AppointmentForm(ModelForm):
             new_value = self.cleaned_data[field] or self.data.get(field)
             if isinstance(new_value, QuerySet):
                 new_human_values = '; '.join([str(element) for element in new_value])
-                new_value = ','.join([str(element.id) for element in new_value]) #overwrite variable
-                #old value
-                if self.instance.id: #update instance
+                new_value = ','.join([str(element.id) for element in new_value])  # overwrite variable
+                # old value
+                if self.instance.id:  # update instance
                     list_of_values = getattr(self.instance, field).all()
                     old_human_values = '; '.join([str(element) for element in list_of_values])
                     previous_value = ','.join([str(element.id) for element in list_of_values])
-                else: #new instance
+                else:  # new instance
                     old_human_values = ''
                     previous_value = ''
                 # description
@@ -69,12 +69,6 @@ class AppointmentForm(ModelForm):
             self.changes.append(p)
 
 
-class AppointmentDetailForm(AppointmentForm):
-    class Meta:
-        model = Appointment
-        fields = '__all__'
-
-
 class AppointmentEditForm(AppointmentForm):
     class Meta:
         model = Appointment
diff --git a/smash/web/urls.py b/smash/web/urls.py
index cb2d9383..feb0184c 100644
--- a/smash/web/urls.py
+++ b/smash/web/urls.py
@@ -51,8 +51,6 @@ urlpatterns = [
     url(r'^appointments$', views.appointment.appointments, name='web.views.appointments'),
     url(r'^appointments/unfinished$', views.appointment.unfinished_appointments,
         name='web.views.unfinished_appointments'),
-    url(r'^appointments/details/(?P<id>\d+)$', views.appointment.appointment_details,
-        name='web.views.appointment_details'),
     url(r'^appointments/add/(?P<visit_id>\d+)$', views.appointment.appointment_add, name='web.views.appointment_add'),
     url(r'^appointments/add/general$', views.appointment.appointment_add, name='web.views.appointment_add_general'),
     url(r'^appointments/edit/(?P<id>\d+)$', views.appointment.appointment_edit, name='web.views.appointment_edit'),
@@ -76,7 +74,7 @@ urlpatterns = [
     url(r'^visits/unfinish/(?P<id>\d+)$', views.visit.visit_unfinish, name='web.views.visit_unfinish'),
     url(r'^visits/add$', views.visit.visit_add, name='web.views.visit_add'),
     url(r'^visits/add/(?P<subject_id>\d+)$', views.visit.visit_add, name='web.views.visit_add'),
-    url(r'^visit/mark/(?P<id>\d+)/(?P<as_what>[A-z]+)$', views.visit.visit_mark, name='web.views.visit_mark'),
+    url(r'^visit/mark/(?P<visit_id>\d+)/(?P<as_what>[A-z]+)$', views.visit.visit_mark, name='web.views.visit_mark'),
 
     ####################
     #    SUBJECTS      #
diff --git a/smash/web/views/appointment.py b/smash/web/views/appointment.py
index b8ca4e21..f65f2022 100644
--- a/smash/web/views/appointment.py
+++ b/smash/web/views/appointment.py
@@ -9,8 +9,7 @@ from django.views.decorators.cache import never_cache
 from django.views.generic import DeleteView
 
 from web.decorators import PermissionDecorator
-from web.forms import AppointmentDetailForm, AppointmentEditForm, AppointmentAddForm, SubjectEditForm, \
-    StudySubjectEditForm
+from web.forms import AppointmentEditForm, AppointmentAddForm, SubjectEditForm, StudySubjectEditForm
 from web.models.appointment_list import APPOINTMENT_LIST_APPROACHING, APPOINTMENT_LIST_GENERIC, \
     APPOINTMENT_LIST_UNFINISHED
 from web.models.constants import GLOBAL_STUDY_ID
@@ -39,12 +38,6 @@ def unfinished_appointments(request):
     return wrap_response(request, "appointments/list.html", context)
 
 
-def appointment_details(request, id):  # pylint: disable=redefined-builtin
-    the_appointment = get_object_or_404(Appointment, id=id)
-    form = AppointmentDetailForm(instance=the_appointment)
-    return wrap_response(request, 'appointments/details.html', {'form': form})
-
-
 def appointment_add(request, visit_id=None):
     if visit_id is not None:
         visit  = get_object_or_404(Visit, id=visit_id)
-- 
GitLab