Opened 3 hours ago

Closed 3 hours ago

Last modified 3 hours ago

#36952 closed Bug (needsinfo)

Fix alter_field when called on a field that not has attribute: concrete

Reported by: Junior Andrade Owned by:
Component: Database layer (models, ORM) Version: 6.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Fix alter_field when called on a field that not has attribute: concrete

When alter_field on class BaseDatabaseSchemaEditor is called on a field that not has attribute concrete, a exception is raised:
AttributeError: 'BooleanField' object has no attribute 'concrete'

Should avoid this exception by checking if the field has the attribute.

Change History (4)

comment:2 by Simon Charette, 3 hours ago

Resolution: needsinfo
Status: newclosed

Field.concrete is set at Field.set_attributes_from_name time which should be systematically called before passing objects to the schema editor.

If there is a core code path that doesn't do so that's likely where the bug lies and not in the schema editor itself.

Given you haven't provided any way to reproduce the problem that demonstrate Django is at fault I'll close the ticket and the associated PR for now.

Please re-open if you can provide a clear example where Django calls alter_field with a Field instance that hasn't been prepared with a prior set_attributes_from_name call.

Version 0, edited 3 hours ago by Simon Charette (next)

comment:3 by Junior Andrade, 3 hours ago

Triage Stage: UnreviewedReady for checkin
Type: UncategorizedBug

comment:4 by Simon Charette, 3 hours ago

Has patch: unset
Triage Stage: Ready for checkinUnreviewed

Please refer to the contributor documentation; you can't mark your own patch as RFC certaintly not before they are even accepted.

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