Remove form renaming
* renames new remove modal forms to match a more coherent style
This commit is contained in:
parent
51a1652baa
commit
a56f202e7f
@ -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.
|
||||
|
@ -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:
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
10
ema/views.py
10
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,
|
||||
|
@ -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.
|
||||
|
@ -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:
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user