From a56f202e7f4cc2e3e90813061bb774f2c857b630 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Tue, 8 Feb 2022 13:31:40 +0100 Subject: [PATCH] Remove form renaming * renames new remove modal forms to match a more coherent style --- compensation/forms/modalForms.py | 6 +++--- compensation/models/compensation.py | 6 +++--- compensation/views/compensation.py | 10 +++++----- compensation/views/eco_account.py | 14 +++++++------- compensation/views/payment.py | 4 ++-- ema/views.py | 10 +++++----- intervention/forms/modalForms.py | 4 ++-- intervention/models/intervention.py | 4 ++-- intervention/views.py | 8 ++++---- konova/forms.py | 2 +- 10 files changed, 34 insertions(+), 34 deletions(-) diff --git a/compensation/forms/modalForms.py b/compensation/forms/modalForms.py index a31dda0c..ae5a6dad 100644 --- a/compensation/forms/modalForms.py +++ b/compensation/forms/modalForms.py @@ -103,7 +103,7 @@ class NewPaymentForm(BaseModalForm): return pay -class PaymentRemoveModalForm(RemoveModalForm): +class RemovePaymentModalForm(RemoveModalForm): """ Removing modal form for Payment Can be used for anything, where removing shall be confirmed by the user a second time. @@ -235,7 +235,7 @@ class NewStateModalForm(BaseModalForm): raise NotImplementedError -class CompensationStateRemoveModalForm(RemoveModalForm): +class RemoveCompensationStateModalForm(RemoveModalForm): """ Removing modal form for CompensationState Can be used for anything, where removing shall be confirmed by the user a second time. @@ -252,7 +252,7 @@ class CompensationStateRemoveModalForm(RemoveModalForm): self.instance.remove_state(self) -class CompensationActionRemoveModalForm(RemoveModalForm): +class RemoveCompensationActionModalForm(RemoveModalForm): """ Removing modal form for CompensationAction Can be used for anything, where removing shall be confirmed by the user a second time. diff --git a/compensation/models/compensation.py b/compensation/models/compensation.py index 46476a67..e90e1735 100644 --- a/compensation/models/compensation.py +++ b/compensation/models/compensation.py @@ -79,7 +79,7 @@ class AbstractCompensation(BaseObject, GeoReferencedMixin): """ Removes a deadline from the abstract compensation Args: - form (DeadlineRemoveModalForm): The form holding all relevant data + form (RemoveDeadlineModalForm): The form holding all relevant data Returns: @@ -119,7 +119,7 @@ class AbstractCompensation(BaseObject, GeoReferencedMixin): """ Removes a CompensationAction from the abstract compensation Args: - form (CompensationActionRemoveModalForm): The form holding all relevant data + form (RemoveCompensationActionModalForm): The form holding all relevant data Returns: @@ -158,7 +158,7 @@ class AbstractCompensation(BaseObject, GeoReferencedMixin): """ Removes a CompensationState from the abstract compensation Args: - form (CompensationStateRemoveModalForm): The form holding all relevant data + form (RemoveCompensationStateModalForm): The form holding all relevant data Returns: diff --git a/compensation/views/compensation.py b/compensation/views/compensation.py index eb4dd371..c4b5c2f5 100644 --- a/compensation/views/compensation.py +++ b/compensation/views/compensation.py @@ -6,13 +6,13 @@ from django.utils.translation import gettext_lazy as _ from compensation.forms.forms import NewCompensationForm, EditCompensationForm from compensation.forms.modalForms import NewStateModalForm, NewDeadlineModalForm, NewActionModalForm, \ - NewCompensationDocumentForm, CompensationActionRemoveModalForm, CompensationStateRemoveModalForm + NewCompensationDocumentForm, RemoveCompensationActionModalForm, RemoveCompensationStateModalForm from compensation.models import Compensation, CompensationState, CompensationAction, CompensationDocument from compensation.tables import CompensationTable from intervention.models import Intervention from konova.contexts import BaseContext from konova.decorators import * -from konova.forms import RemoveModalForm, SimpleGeomForm, DeadlineRemoveModalForm +from konova.forms import RemoveModalForm, SimpleGeomForm, RemoveDeadlineModalForm from konova.models import Deadline from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER from konova.utils.documents import get_document, remove_document @@ -414,7 +414,7 @@ def deadline_remove_view(request: HttpRequest, id: str, deadline_id: str): """ comp = get_object_or_404(Compensation, id=id) deadline = get_object_or_404(Deadline, id=deadline_id) - form = DeadlineRemoveModalForm(request.POST or None, instance=comp, deadline=deadline, request=request) + form = RemoveDeadlineModalForm(request.POST or None, instance=comp, deadline=deadline, request=request) return form.process_request( request, msg_success=DEADLINE_REMOVED, @@ -438,7 +438,7 @@ def state_remove_view(request: HttpRequest, id: str, state_id: str): """ comp = get_object_or_404(Compensation, id=id) state = get_object_or_404(CompensationState, id=state_id) - form = CompensationStateRemoveModalForm(request.POST or None, instance=comp, state=state, request=request) + form = RemoveCompensationStateModalForm(request.POST or None, instance=comp, state=state, request=request) return form.process_request( request, msg_success=COMPENSATION_STATE_REMOVED, @@ -462,7 +462,7 @@ def action_remove_view(request: HttpRequest, id: str, action_id: str): """ comp = get_object_or_404(Compensation, id=id) action = get_object_or_404(CompensationAction, id=action_id) - form = CompensationActionRemoveModalForm(request.POST or None, instance=comp, action=action, request=request) + form = RemoveCompensationActionModalForm(request.POST or None, instance=comp, action=action, request=request) return form.process_request( request, msg_success=COMPENSATION_ACTION_REMOVED, diff --git a/compensation/views/eco_account.py b/compensation/views/eco_account.py index f6cced09..7d1e560f 100644 --- a/compensation/views/eco_account.py +++ b/compensation/views/eco_account.py @@ -16,14 +16,14 @@ from django.shortcuts import render, get_object_or_404, redirect from compensation.forms.forms import NewEcoAccountForm, EditEcoAccountForm from compensation.forms.modalForms import NewStateModalForm, NewActionModalForm, NewDeadlineModalForm, \ - NewEcoAccountDocumentForm, CompensationActionRemoveModalForm, CompensationStateRemoveModalForm + NewEcoAccountDocumentForm, RemoveCompensationActionModalForm, RemoveCompensationStateModalForm from compensation.models import EcoAccount, EcoAccountDocument, CompensationState, CompensationAction from compensation.tables import EcoAccountTable -from intervention.forms.modalForms import NewDeductionModalForm, ShareModalForm, DeductionRemoveModalForm +from intervention.forms.modalForms import NewDeductionModalForm, ShareModalForm, RemoveEcoAccountDeductionModalForm from konova.contexts import BaseContext from konova.decorators import any_group_check, default_group_required, conservation_office_group_required, \ shared_access_required -from konova.forms import RemoveModalForm, SimpleGeomForm, NewDocumentForm, RecordModalForm, DeadlineRemoveModalForm +from konova.forms import RemoveModalForm, SimpleGeomForm, NewDocumentForm, RecordModalForm, RemoveDeadlineModalForm from konova.models import Deadline from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER @@ -286,7 +286,7 @@ def deduction_remove_view(request: HttpRequest, id: str, deduction_id: str): except ObjectDoesNotExist: raise Http404("Unknown deduction") - form = DeductionRemoveModalForm(request.POST or None, instance=acc, deduction=eco_deduction, request=request) + form = RemoveEcoAccountDeductionModalForm(request.POST or None, instance=acc, deduction=eco_deduction, request=request) return form.process_request( request=request, msg_success=DEDUCTION_REMOVED, @@ -403,7 +403,7 @@ def state_remove_view(request: HttpRequest, id: str, state_id: str): """ acc = get_object_or_404(EcoAccount, id=id) state = get_object_or_404(CompensationState, id=state_id) - form = CompensationStateRemoveModalForm(request.POST or None, instance=acc, state=state, request=request) + form = RemoveCompensationStateModalForm(request.POST or None, instance=acc, state=state, request=request) return form.process_request( request, msg_success=COMPENSATION_STATE_REMOVED, @@ -427,7 +427,7 @@ def action_remove_view(request: HttpRequest, id: str, action_id: str): """ acc = get_object_or_404(EcoAccount, id=id) action = get_object_or_404(CompensationAction, id=action_id) - form = CompensationActionRemoveModalForm(request.POST or None, instance=acc, action=action, request=request) + form = RemoveCompensationActionModalForm(request.POST or None, instance=acc, action=action, request=request) return form.process_request( request, msg_success=COMPENSATION_ACTION_REMOVED, @@ -451,7 +451,7 @@ def deadline_remove_view(request: HttpRequest, id: str, deadline_id: str): """ comp = get_object_or_404(EcoAccount, id=id) deadline = get_object_or_404(Deadline, id=deadline_id) - form = DeadlineRemoveModalForm(request.POST or None, instance=comp, deadline=deadline, request=request) + form = RemoveDeadlineModalForm(request.POST or None, instance=comp, deadline=deadline, request=request) return form.process_request( request, msg_success=DEADLINE_REMOVED, diff --git a/compensation/views/payment.py b/compensation/views/payment.py index d1fa91b2..7be9bee8 100644 --- a/compensation/views/payment.py +++ b/compensation/views/payment.py @@ -11,7 +11,7 @@ from django.contrib.auth.decorators import login_required from django.http import HttpRequest from django.shortcuts import get_object_or_404 -from compensation.forms.modalForms import NewPaymentForm, PaymentRemoveModalForm +from compensation.forms.modalForms import NewPaymentForm, RemovePaymentModalForm from compensation.models import Payment from intervention.models import Intervention from konova.decorators import default_group_required @@ -55,7 +55,7 @@ def payment_remove_view(request: HttpRequest, id: str, payment_id: str): """ intervention = get_object_or_404(Intervention, id=id) payment = get_object_or_404(Payment, id=payment_id) - form = PaymentRemoveModalForm(request.POST or None, instance=intervention, payment=payment, request=request) + form = RemovePaymentModalForm(request.POST or None, instance=intervention, payment=payment, request=request) return form.process_request( request=request, msg_success=PAYMENT_REMOVED, diff --git a/ema/views.py b/ema/views.py index 5f60c7a2..900dde7c 100644 --- a/ema/views.py +++ b/ema/views.py @@ -7,7 +7,7 @@ from django.urls import reverse from django.utils.translation import gettext_lazy as _ from compensation.forms.modalForms import NewStateModalForm, NewActionModalForm, NewDeadlineModalForm, \ - CompensationActionRemoveModalForm, CompensationStateRemoveModalForm + RemoveCompensationActionModalForm, RemoveCompensationStateModalForm from compensation.models import CompensationAction, CompensationState from ema.forms import NewEmaForm, EditEmaForm, NewEmaDocumentForm from ema.tables import EmaTable @@ -15,7 +15,7 @@ from intervention.forms.modalForms import ShareModalForm from konova.contexts import BaseContext from konova.decorators import conservation_office_group_required, shared_access_required from ema.models import Ema, EmaDocument -from konova.forms import RemoveModalForm, SimpleGeomForm, RecordModalForm, DeadlineRemoveModalForm +from konova.forms import RemoveModalForm, SimpleGeomForm, RecordModalForm, RemoveDeadlineModalForm from konova.models import Deadline from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER @@ -428,7 +428,7 @@ def state_remove_view(request: HttpRequest, id: str, state_id: str): """ ema = get_object_or_404(Ema, id=id) state = get_object_or_404(CompensationState, id=state_id) - form = CompensationStateRemoveModalForm(request.POST or None, instance=ema, state=state, request=request) + form = RemoveCompensationStateModalForm(request.POST or None, instance=ema, state=state, request=request) return form.process_request( request, msg_success=COMPENSATION_STATE_REMOVED, @@ -452,7 +452,7 @@ def action_remove_view(request: HttpRequest, id: str, action_id: str): """ ema = get_object_or_404(Ema, id=id) action = get_object_or_404(CompensationAction, id=action_id) - form = CompensationActionRemoveModalForm(request.POST or None, instance=ema, action=action, request=request) + form = RemoveCompensationActionModalForm(request.POST or None, instance=ema, action=action, request=request) return form.process_request( request, msg_success=COMPENSATION_ACTION_REMOVED, @@ -595,7 +595,7 @@ def deadline_remove_view(request: HttpRequest, id: str, deadline_id: str): """ ema = get_object_or_404(Ema, id=id) deadline = get_object_or_404(Deadline, id=deadline_id) - form = DeadlineRemoveModalForm(request.POST or None, instance=ema, deadline=deadline, request=request) + form = RemoveDeadlineModalForm(request.POST or None, instance=ema, deadline=deadline, request=request) return form.process_request( request, msg_success=DEADLINE_REMOVED, diff --git a/intervention/forms/modalForms.py b/intervention/forms/modalForms.py index d9112b1e..6e2a2a39 100644 --- a/intervention/forms/modalForms.py +++ b/intervention/forms/modalForms.py @@ -172,7 +172,7 @@ class NewRevocationModalForm(BaseModalForm): return revocation -class RevocationRemoveModalForm(RemoveModalForm): +class RemoveRevocationModalForm(RemoveModalForm): """ Removing modal form for Revocation Can be used for anything, where removing shall be confirmed by the user a second time. @@ -407,7 +407,7 @@ class NewDeductionModalForm(BaseModalForm): return deduction -class DeductionRemoveModalForm(RemoveModalForm): +class RemoveEcoAccountDeductionModalForm(RemoveModalForm): """ Removing modal form for EcoAccountDeduction Can be used for anything, where removing shall be confirmed by the user a second time. diff --git a/intervention/models/intervention.py b/intervention/models/intervention.py index 79277339..821a835f 100644 --- a/intervention/models/intervention.py +++ b/intervention/models/intervention.py @@ -234,7 +234,7 @@ class Intervention(BaseObject, ShareableObjectMixin, RecordableObjectMixin, Chec """ Removes a revocation from the intervention Args: - form (RevocationRemoveModalForm): The form holding all relevant data + form (RemoveRevocationModalForm): The form holding all relevant data Returns: @@ -309,7 +309,7 @@ class Intervention(BaseObject, ShareableObjectMixin, RecordableObjectMixin, Chec """ Removes a Payment from the intervention Args: - form (PaymentRemoveModalForm): The form holding all relevant data + form (RemovePaymentModalForm): The form holding all relevant data Returns: diff --git a/intervention/views.py b/intervention/views.py index 41f484c5..c0317035 100644 --- a/intervention/views.py +++ b/intervention/views.py @@ -6,8 +6,8 @@ from django.shortcuts import render from intervention.forms.forms import NewInterventionForm, EditInterventionForm from intervention.forms.modalForms import ShareModalForm, NewRevocationModalForm, \ - CheckModalForm, NewDeductionModalForm, NewInterventionDocumentForm, DeductionRemoveModalForm, \ - RevocationRemoveModalForm + CheckModalForm, NewDeductionModalForm, NewInterventionDocumentForm, RemoveEcoAccountDeductionModalForm, \ + RemoveRevocationModalForm from intervention.models import Intervention, Revocation, InterventionDocument, RevocationDocument from intervention.tables import InterventionTable from konova.contexts import BaseContext @@ -355,7 +355,7 @@ def remove_revocation_view(request: HttpRequest, id: str, revocation_id: str): intervention = get_object_or_404(Intervention, id=id) revocation = get_object_or_404(Revocation, id=revocation_id) - form = RevocationRemoveModalForm(request.POST or None, instance=intervention, revocation=revocation, request=request) + form = RemoveRevocationModalForm(request.POST or None, instance=intervention, revocation=revocation, request=request) return form.process_request( request, REVOCATION_REMOVED, @@ -536,7 +536,7 @@ def remove_deduction_view(request: HttpRequest, id: str, deduction_id: str): except ObjectDoesNotExist: raise Http404("Unknown deduction") - form = DeductionRemoveModalForm(request.POST or None, instance=intervention, deduction=eco_deduction, request=request) + form = RemoveEcoAccountDeductionModalForm(request.POST or None, instance=intervention, deduction=eco_deduction, request=request) return form.process_request( request=request, msg_success=DEDUCTION_REMOVED, diff --git a/konova/forms.py b/konova/forms.py index 66aeea70..ca7ac0e1 100644 --- a/konova/forms.py +++ b/konova/forms.py @@ -330,7 +330,7 @@ class RemoveModalForm(BaseModalForm): self.instance.delete() -class DeadlineRemoveModalForm(RemoveModalForm): +class RemoveDeadlineModalForm(RemoveModalForm): """ Removing modal form for deadlines Can be used for anything, where removing shall be confirmed by the user a second time.