1👍
✅
You’re looking for values_list
:
>>> allmarketplaces = SellerMarketplaces.objects.filter(seller_id=seller).values_list('mk_id__marketplace', flat=True)
>>> print allmarketplaces
['Flipkart', 'Snapdeal']
0👍
Try this,
for i in range(len(allmarketplaces)):
print allmarketplaces[i]['mk_id__marketplace']
- Error while declaring a list of lists in django
- Sort Django Rest Framework JSON Output
- Can't seem to use optional foreign key relationships when creating new object using Django+AngularJS
- HTTP Error 500: internal server error
Source:stackexchange.com