1👍
✅
You can work with a ternary operator:
for i in data['result'].values():
kraken_data = Kraken.objects.create(
altname = i['altname'],
leverage_buy = i['leverage_buy'][0] if i['leverage_buy'] else None
)
Source:stackexchange.com