My code which is working:
def json_response(self, request):
...
return JsonResponse({
'Name': 'Harry' if name.pretty else name.something
I want to add nested if statment but i dont know how. It should be something like:
'Name': Harry if name.pretty else name.something(if exists) otherwise name.something_else
Aucun commentaire:
Enregistrer un commentaire