Why does assigning value to Django Object change the value from NoneType to Tuple? [closed]
I am polling an API and I am returned a dictionary. I take this dictionary and attempt to take the data from it and assign it to a new django object:
def write_object(account, data):
#account is a Django object
#data is a dictionary from an API
#check to see if object already exists
if Obj.objects.filter(account=account, pk=data['id']).exists() == False:
#create new
Obj.objects.create(account=account, pk=data['id'])
#object already exists, fetch relevant application object
obj = Obj.objects.get(account=account, pk=data['id'])
#assign the values from data to the object
obj.name = data['name'],
obj.notes = data['notes'],
obj.status = data['status'],
obj.created_at = iso8601_to_datetime(data['created_at'])
This all works fine, except I am confused why the object values are now tuples after they assigned to an object.
print(type(data)) -> <class 'dict'>
print(data['notes']) -> None
print(type(data['notes'])) -> <class 'NoneType'>
print(obj.notes) -> (None,)
print(type(obj.notes)) -> <class 'tuple'>
print(data['opened_at']) -> 2022-02-28T15:23:11.000Z
print(obj.opened_at) -> datetime.datetime(2022, 2, 28, 15, 23, 11, tzinfo=),)
print(type(obj.opened_at)) -> <class 'tuple'>
My question is: How do the data types become tuples when I assign it to the object?