Creating a normal preview for contract drafts
This commit is contained in:
@@ -5,7 +5,7 @@ from ..core.routes import get_crud_router
|
||||
from .routes_draft import draft_router
|
||||
from .print import print_router
|
||||
|
||||
from .models import Contract, ContractDraft
|
||||
from .models import Contract, ContractDraft, replace_variables_in_value
|
||||
from .schemas import ContractCreate, ContractRead, ContractUpdate
|
||||
|
||||
from ..entity.models import Entity
|
||||
@@ -74,9 +74,3 @@ async def create(item: ContractCreate, user=Depends(can_create_contract)) -> dic
|
||||
@contract_router.put("/{id}", response_description="")
|
||||
async def update(id: str, req: ContractUpdate) -> ContractRead:
|
||||
raise HTTPException(status_code=400, detail="No modification on contract")
|
||||
|
||||
|
||||
def replace_variables_in_value(variables, value: str):
|
||||
for v in variables:
|
||||
value = value.replace('%{}%'.format(v.key), v.value)
|
||||
return value
|
||||
|
||||
Reference in New Issue
Block a user