I want to pass parameter in view and i execute the insert query as shown below.
I have searched and failed to get a solution.
Any hints.
Here is the code. My attempt is shown but not correct.
def post_payroll(request,p_id):
p_id=2
with connection.cursor() as cursor:
query = "insert into payroll_payrolltemp(ndays,sdays,ot1hr,ot2hr,advance,bonus,penalty,post_status,worker_id,payperiod_id)"
"select 0,0,0,0,0,0,0,0,sw.id," str(p_id) +" as payperiod_id from staff_worker as sw"
"where sw.id in (select w.worker_id from staff_workerpay as w where w .pay_frequency_id=1) order by sw.id"
cursor.execute(query)