1👍
You are doing a lot of wrong thing in your views. If you look at your model Attendence_data
, it has two fields user_name and employee_number. so its constructor would accept two arguments, user_name
and employee_number
or any other fields that are set not to be NULL and have no default value, so passing request.user.id to the its constructor would not make it a valid object. Same is the case with Leave_work
model. So if you need to do this, you need to overload the default constructor.
But seems like you are not being able to understand the basic concepts of how Django works so I’d suggest you to go trough this tutorial as this will clear a lot of basic concepts.
Source:stackexchange.com