Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#25226 closed Bug (fixed)

ArrayField doesn't set the model attribute on the base_field instance

Reported by: Ion Scerbatiuc Owned by: Tim Graham <timograham@…>
Component: contrib.postgres Version: master
Severity: Normal Keywords: arrayfield check-framework
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I found this issue while working on #25172. The ArrayField uses the check framework to perform backend specific checks on the base_field instance, but doesn't set the model attribute on it.
Since the backend specific field tests will use the model to route to the appropriate db connection, we need to have the model set on the base_field instance too.

Here's the PR in github with the proposed fix: https://github.com/django/django/pull/5104

Attachments (1)

arrayfield-set-model-on-base-field.diff (1.4 KB) - added by Ion Scerbatiuc 4 years ago.
The proposed fix

Download all attachments as: .zip

Change History (3)

Changed 4 years ago by Ion Scerbatiuc

The proposed fix

comment:1 Changed 4 years ago by Tim Graham <timograham@…>

Owner: set to Tim Graham <timograham@…>
Resolution: fixed
Status: newclosed

In 5208021:

Fixed #25226 -- Set the model attribute on ArrayField's base_field

comment:2 Changed 3 years ago by Tim Graham <timograham@…>

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

In 2e557908:

Refs #25226 -- Cloned ArrayField.base_field on deconstruction.

This prevents the base_field from sharing attributes with the one used
during migrations.

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