#34570: QuerySet.defer() raises an AttributeError when the field is
ManyToManyField or GenericForeignKey
-------------------------------------+-------------------------------------
Reporter: Paco MartÃnez | Owner: Simon
| Charette
Type: Bug | Status: assigned
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: contenttypes, | Triage Stage: Accepted
defer, manytomanyfield, |
genericforeignkey |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):
* owner: nobody => Simon Charette
* status: new => assigned
Comment:
> In version 4.1.9 it is working without any error, but in versions 4.2.0
and 4.2.1 raises the AttributeError
Could you elaborate on that? Many-to-many fields and generic foreign keys
are not deferrable (they are virtual and do not map to columns) so the
previous code was simply swallowing invalid values passed to `defer`.
I guess that raising a more detailed exception would still require a
deprecation period and that it would be better to perform this validation
at `defer`/`only` instead of compilation time anyway so our only option
here is to silence cases where `opts.get_field(field_name)` returns
something that doesn't have a `.field` property.
--
Ticket URL: <https://code.djangoproject.com/ticket/34570#comment:2>
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/0107018825ecfb47-811335c1-9ef9-4ad4-a5e6-4864a1bbacb6-000000%40eu-central-1.amazonses.com.