#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:1 by , 92 minutes ago
comment:2 by , 86 minutes ago
| Resolution: | → needsinfo |
|---|---|
| Status: | new → closed |
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.
comment:3 by , 86 minutes ago
| Triage Stage: | Unreviewed → Ready for checkin |
|---|---|
| Type: | Uncategorized → Bug |
comment:4 by , 84 minutes ago
| Has patch: | unset |
|---|---|
| Triage Stage: | Ready for checkin → Unreviewed |
Please refer to the contributor documentation; you can't mark your own patch as RFC certaintly not before they are even accepted.
Patch: https://github.com/django/django/pull/20769