I have a bunch of portions like this :
server_dict = {
'total_price': total_price,
'total_price_usd': total_price_usd,
'location_name': server.get("location", ""),
'os_name': server.get("os", ""),
'database_name': server.get("db", ""),
.
.
.
}
s = Server(**server_dict)
s.save()
This was for adding a row.
If I wanted to use the same code for updating, is this a good approach ?
if order_id > 0:
server_dict['id'] = order_id
s = Server(**server_dict)
s.save()