EcoAccount withdraws
* adds functionality for withdraws from eco accounts in detail view of interventions and eco account as well * adds get_surface() method to AbstractCompensation class to provide a simple getter for a sql calculation * adds get_surface_withdraws() method to EcoAccount class to provide a simple getter for a sql calculation * renames some routes to match coherent rout naming * adds logic check on NewWithdrawForm * renames templates/table directory to templates/form, since there are form-table templates inside --> more clarity * adds new autocomplete routes to konova/urls.py for Interventions and EcoAccounts * adds/updates translations * adds/updates template comments * updates requirements.txt
This commit is contained in:
@@ -5,7 +5,7 @@ from django.http import HttpRequest
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
|
||||
from intervention.forms import NewInterventionForm, EditInterventionForm, ShareInterventionForm, NewRevocationForm, \
|
||||
RunCheckForm
|
||||
RunCheckForm, NewWithdrawForm
|
||||
from intervention.models import Intervention, Revocation
|
||||
from intervention.tables import InterventionTable
|
||||
from konova.contexts import BaseContext
|
||||
@@ -392,3 +392,23 @@ def log_view(request: HttpRequest, id: str):
|
||||
}
|
||||
context = BaseContext(request, context).context
|
||||
return render(request, template, context)
|
||||
|
||||
|
||||
@login_required
|
||||
@default_group_required
|
||||
def new_withdraw_view(request: HttpRequest, id: str):
|
||||
""" Renders a modal form view for creating withdraws
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
id (str): The intervention's id which shall get a new withdraw
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
intervention = get_object_or_404(Intervention, id=id)
|
||||
form = NewWithdrawForm(request.POST or None, instance=intervention, user=request.user)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=_("Withdraw added")
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user