# Should Query.add\_ordering() raise FieldError exception?

**URL:** <https://forum.djangoproject.com/t/should-query-add-ordering-raise-fielderror-exception/11838>\
**Category:** ORM\
**Created:** [January 27, 2022, 12:51pm UTC](https://forum.djangoproject.com/t/should-query-add-ordering-raise-fielderror-exception/11838 "2022-01-27T12:51:16Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![kirtan73](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kirtan73/32/8483_2.png) [@kirtan73](https://forum.djangoproject.com/u/kirtan73)\
**Post date:** [May 13, 2022, 3:09am UTC](https://forum.djangoproject.com/t/should-query-add-ordering-raise-fielderror-exception/11838/12 "2022-05-13T03:09:08Z")

</div>

@KenWhitesell @k-talipov  
I have added here all the details:

> [@Facing django.core.exceptions.FieldError: Cannot resolve keyword \`opportunity\_count\` into field.](https://forum.djangoproject.com/t/facing-django-core-exceptions-fielderror-cannot-resolve-keyword-opportunity-count-into-field/13674):
>
> When upgrading Django from 3.0.6 to 3.2.12, I was unable to order response by annotated fields it is throwing Field error views.py class AccountViewSet(ViewSetMixin, viewsets.ModelViewSet): filter\_backends = (AccountAnnotationFilterBackend, AccountFilterBackend,) ... filters.py class AccountAnnotationFilterBackend(BaseFilterBackend): def filter\_queryset(self, request, queryset, view): relationship\_id = request.query\_params.get("relationship", "") if relationship…

Do let me know if any further information is required.

---

_[View the full topic](https://forum.djangoproject.com/t/should-query-add-ordering-raise-fielderror-exception/11838)._
