#36151: Non-editable FieldError raised when using a GenericForeignKey on a form.
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: James Pic
Type: Bug | Status: closed
Component: | Version: 5.1
contrib.contenttypes |
Severity: Release blocker | Resolution: wontfix
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):
* resolution: => wontfix
* status: assigned => closed
Comment:
Have considered and discussed this quite a bit
[https://docs.djangoproject.com/en/5.1/ref/contrib/contenttypes/#django.contrib.contenttypes.fields.GenericForeignKey
GenericForeignKey] explicitly documents that they are not included on
`ModelForms`. Part of the reason is that a `GenericForeignKey` would need
a custom form field (with a custom widget), which is not currently defined
on the `GenericForeignKey.formfield()` and would also be a little
complicated (it doesn't make sense to have both this field and the
underlying `ct_field` and `fk_field` defined on the field).
Hence, it makes sense for a custom `EditableGenericForeignKey` field to be
defined in someone's project which uses the custom field widget in
`formfield` and sets the field as `editable=True` (and likely sets the
`ct_field` and `fk_field` as `editable=False`). This is roughly suggested
as a solution in the [https://forum.djangoproject.com/t/non-editable-
error-for-a-genericforeignkey-in-an-modelform-when-updating-to-
version-5-1/35033 forum discussion].
The behavior we now have is aligned to other fields and matches our
documentation. Hence, I will update the status to `wontfix`.
--
Ticket URL: <https://code.djangoproject.com/ticket/36151#comment:10>
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 visit
https://groups.google.com/d/msgid/django-updates/01070194bdbb99b5-9622945f-f195-41ab-8bc7-c222d4ab738b-000000%40eu-central-1.amazonses.com.