start to write contract apis
This commit is contained in:
0
core/apps/contracts/tasks/__init__.py
Normal file
0
core/apps/contracts/tasks/__init__.py
Normal file
27
core/apps/contracts/tasks/contract_side.py
Normal file
27
core/apps/contracts/tasks/contract_side.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
from celery import shared_task
|
||||
|
||||
from core.apps.contracts.models.contract import ContractSide, Contract, ContractSignature
|
||||
|
||||
@shared_task
|
||||
def create_contract_side(data):
|
||||
User = get_user_model()
|
||||
|
||||
contract = Contract.objects.get(id=data['contract_id'])
|
||||
user = User.objects.get(phone=data['phone'])
|
||||
|
||||
ContractSide.objects.create(
|
||||
full_name=data.get('full_name'),
|
||||
indentification=data.get('indentification'),
|
||||
position=data.get('position'),
|
||||
has_indentification=data.get('has_indentification'),
|
||||
user_role=data.get('user_role'),
|
||||
contract=contract,
|
||||
user=user
|
||||
)
|
||||
|
||||
ContractSignature.objects.create(
|
||||
contract=contract,
|
||||
user=user,
|
||||
)
|
||||
Reference in New Issue
Block a user