I'm trying to update a column value through django model, backed legacy db is postgressql, the column in db is defined as: "numbers integer[] NOT NULL" in my django application's models.py i have the column as : "numbers = ArrayField(models.IntegerField())" in the code i'm trying to update as below:
user = class_name.objects.using('default').get(id=14)
user.numbers = number # here value number is a list
user.save()
this part of code is inside try and exception block i'm not seeing any errors but the save() part is not executing i.e code stops there not going to next lines
view function:
def test(number,value):
try:
user = classname.objects.using('default').get(id=value)
user.numbers = number
user.save()
return Response ({"status": "Success","statusCode": "200",
"statusMessage" : "role%s added to user account %s successfully." %((role),(value))},status=status.HTTP_200_OK)
except Exception as e:
logger.error("An error occurred while updating the roles, Error :%s,Reason:%s",str(e),e_msg,extra={'jobid':job_id})
return Response({"status": "Failure", "statusCode" : "500", "statusMessage": str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
print(type(numbers))and see whether it is a list of numbers or not.