4👍
✅
The Customer
field should be a User
instance, but you are passing a model instance to the Customer
field while creating an AssistanceQuest.
So change this
Assistance = AssistanceQuest(Customer=user, Status= 'False',Request= Message, Tipology='Tecnica',Date_request=datetime.datetime.now())
to
Assistance = AssistanceQuest(Customer=request.user, Status= 'False',Request= Message, Tipology='Tecnica',Date_request=datetime.datetime.now())
Assuming that authenticated user is the customer
Source:stackexchange.com