diff options
Diffstat (limited to 'archaeological_operations')
| -rw-r--r-- | archaeological_operations/models.py | 35 | ||||
| -rw-r--r-- | archaeological_operations/urls.py | 14 | ||||
| -rw-r--r-- | archaeological_operations/views.py | 43 | 
3 files changed, 1 insertions, 91 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index af689f421..3717ba9b9 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -31,7 +31,7 @@ from django.contrib.gis.db.models.functions import Centroid  from django.contrib.postgres.indexes import GinIndex  from django.contrib.sites.models import Site  from django.db import transaction, OperationalError, IntegrityError -from django.db.models import Q, Count, Sum, Max, Avg +from django.db.models import Q, Max  from django.db.models.signals import post_save, m2m_changed, post_delete  from django.forms import ValidationError  from django.urls import reverse @@ -594,14 +594,6 @@ class ArchaeologicalSite(          QA_EDIT,          QA_LOCK,          QuickAction( -            url="site-add-operation", -            icon_class="fa fa-plus", -            text=_("Create associated operation"), -            target="many", -            rights=["change_operation"], -            is_popup=False -        ), -        QuickAction(              url="site-qa-duplicate",              icon_class="fa fa-clone",              text=_("Duplicate"), @@ -799,31 +791,6 @@ class ArchaeologicalSite(                  ),              ] -        can_create_operation = self.can_do(request, "change_operation") -        if can_create_operation and not self.operations.count(): -            actions.append( -                ( -                    reverse("site-add-operation", args=[self.pk]), -                    _("Create an operation associated to this site"), -                    "fa fa-plus", -                    _("ope."), -                    "", -                    False -                ) -            ) - -        if can_create_operation and self.operations.count(): -            actions.append( -                ( -                    reverse("site-add-top-operation", args=[self.pk]), -                    _("Create a cluster operation for site associated to many operations"), -                    "fa fa-plus", -                    _("top ope."), -                    "", -                    False -                ) -            ) -          if can_edit_site:              actions += [                  ( diff --git a/archaeological_operations/urls.py b/archaeological_operations/urls.py index 7f5080c39..dd0c28b75 100644 --- a/archaeological_operations/urls.py +++ b/archaeological_operations/urls.py @@ -400,20 +400,6 @@ urlpatterns = [          kwargs={"confirm": True},      ),      url( -        r"^site-add-operation/(?P<pks>[0-9-]+)?/$", -        check_rights(["change_operation"])( -            views.site_add_operation -        ), -        name="site-add-operation", -    ), -    url( -        r"^site-add-top-operation/(?P<pks>\d+)?/$", -        check_rights(["change_operation"])( -            views.site_add_top_operation -        ), -        name="site-add-top-operation", -    ), -    url(          r"generate-stats-operation/(?P<pk>.+)/",          views.GenerateStatsOperation.as_view(),          name="generate-stats-operation", diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py index 0cede556c..cc6eef0c2 100644 --- a/archaeological_operations/views.py +++ b/archaeological_operations/views.py @@ -782,49 +782,6 @@ def site_delete(request, pk):      return redirect(reverse(wizard_url, kwargs={"step": "final-" + wizard_url})) -def site_add_operation(request, pks, current_right=None): -    pks = [int(p) for p in pks.split("-")] -    for pk in pks: -        q = models.ArchaeologicalSite.objects.filter(pk=pk) -        if not q.count(): -            raise Http404() -        site = q.all()[0] -        if not site.can_do(request, "view_archaeologicalsite") \ -                or site.operations.count(): -            raise Http404() -    # operation add permission checked on view call -    operation_creation_wizard(request) -    wizards.OperationWizard.session_set_value( -            request, "general-operation_creation", "archaeological_site", pks, -            reset=True -    ) -    return redirect( -        reverse("operation_creation", kwargs={"step": "general-operation_creation"}) -    ) - - -def site_add_top_operation(request, pks, current_right=None): -    q = models.ArchaeologicalSite.objects.filter(pk=pks) -    if not q.count(): -        raise Http404() -    site = q.all()[0] -    if not site.can_do(request, "view_archaeologicalsite") \ -            or not site.operations.count(): -        raise Http404() -    # operation add permission checked on view call -    top_operation = site.create_or_update_top_operation(create=True) -    if not wizard_is_available( -            operation_modification_wizard, request, models.Operation, top_operation.pk -    ): -        return HttpResponseRedirect("/") - -    wizard_url = "operation_modification" -    wizards.OperationModificationWizard.session_set_value( -        request, "selec-" + wizard_url, "pk", top_operation.pk, reset=True -    ) -    return redirect(reverse(wizard_url, kwargs={"step": "general-" + wizard_url})) - -  operation_administrativeactop_search_wizard = wizards.SearchWizard.as_view(      [          (  | 
