Opened 3 years ago

Closed 3 years ago

#32802 closed New feature (wontfix)

Ability to generate GenericForeignKey from class properties

Reported by: Timur Kadyev Owned by: nobody
Component: contrib.contenttypes Version: 3.2
Severity: Normal Keywords: GenericForeignKey
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Generating GenericForeignKey currently assumes pass it the names of the two fields. These fields are default named “content_type” and “object_id”.
Sometimes in practice it is convenient to calculate the values of these fields (ex. property). In this case, you have to create two additional fields in which you need to write properties values in order to pass the GenericForeignKey name validation.
It would be nice to change the GenericForeignKey name validation to accept not only fields but also properties.

Change History (1)

comment:1 by Mariusz Felisiak, 3 years ago

Resolution: wontfix
Status: newclosed

Thanks for this ticket, however even if it's feasible I don't think there would be consensus to add that complexity. You can raise the idea on the DevelopersMailingList to reach a wider audience and see what other think.

Note: See TracTickets for help on using tickets.
Back to Top