#35269: GeneratedFields can't be defined on RelatedFields
-------------------------------------+-------------------------------------
Reporter: Perrine | Owner: nobody
L. |
Type: Bug | Status: new
Component: Database | Version: 5.0
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
It is not possible to define a GeneratedField with a ForeignKey or a
ManyToManyField as an output_field.
When those RelatedFields are defined as output_field, an error is raised
```AttributeError: 'ForeignKey' object has no attribute 'opts'``` line
190, in _check_relation_model_exists or line 494, in related_query_name
(cf.
https://github.com/django/django/blob/3d4fe39bac082b835a2d82b717b6ae88ea70ea15/django/db/models/fields/related.py)
At least with Postgres as a backend, there doesn't seem to be any
technical impossibility to make a GeneratedField on a ForeignKey or
ManyToMany fields : https://www.postgresql.org/docs/current/ddl-generated-
columns.html
--
Ticket URL: <https://code.djangoproject.com/ticket/35269>
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/0107018e0a3edac9-5a386102-cf20-4f23-a0bc-7fc254fd4515-000000%40eu-central-1.amazonses.com.