#31305: FieldError when doing batch update from the list view
-------------------------------------+-------------------------------------
Reporter: Ciske | Owner: nobody
Boekelo |
Type: Bug | Status: new
Component: | Version: 2.1
contrib.admin | Keywords: FieldError
Severity: Normal | annotation batch update admin
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I'm getting a FieldError when the following conditions are met:
- I'm in the admin, looking at a list view
- in the ModelAdmin, I've overridden get_queryset() to add an annotation
(a Sum operation) before returning the queryset
- ***I've sorted the view by this annotation column.***
- I have selected a few items
- I perform a batch action
- in the batch action I do a batch update with queryset.update()
I get this error:
Internal Server Error: /admin/.../
FieldError at /admin/.../
Cannot resolve keyword 'x' into field. Choices are: y, z, ...
Request Method: POST
Request URL: https://host.com/admin/.../?o=-6
Django Version: 2.1
Python Executable: /usr/bin/python3
Python Version: 3.6.9
Column -6 in the URL being the annotation column.
I do NOT get an error when all conditions are the same, except I haven't
sorted by the annotation column.
--
Ticket URL: <https://code.djangoproject.com/ticket/31305>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/055.83195fba089c8cd1b94758feee2bfdec%40djangoproject.com.