Assigning a Django Model's field to a value if it matches a condition.
g = Car.objects.get(pk=1234)
g.data_version = my_dict['dataVersion'] if my_dict else expression_false # Do nothing??
How do I do nothing in that case? We can't do if conditional else pass
.
I know I can do:
if my_dict:
g.data_version = my_dict['dataVersion']
but I was wondering if there was a way to do inline expression_true if conditional else do nothing
.