1👍
✅
This Error is happening after queryset is returned by the get_queryset, since LocationViewSet has ‘ordering’ attribute which tries to re-oder the queryset again.
1👍
You can write raw query for 10 result in your code like that it will work,
org = Organization.objects.raw('SELECT organization_id, name FROM organization where is_active=1 ORDER BY name limit 10')
Keep one thing in a raw query you have to always fetch primary key of table, it’s mandatory. Here organization_id
is a primary key of contact_organization
table.
- [Answered ]-How to filter points in range with geodjango
- [Answered ]-Django urls.py not rendering correct template
- [Answered ]-How to use curent date in image path django
Source:stackexchange.com