0👍
Check out using the values_list() method, which can return a list of values if you have only one field you need and you pass it flat = True:
instances = MyModel2.objects.filter(...).values_list('id', flat=True)
- [Answer]-Which could be a good way to design an authentication mechanism to restrict the access to the backend to only registered users?
- [Answer]-Django 1.6 upgrade: "cannot import name BaseHandler"
- [Answer]-Combine strings from mysql tables without extra spaces
- [Answer]-Inheriting bootstrap with css in base.html
Source:stackexchange.com