Opened 4 years ago

Closed 4 years ago

#31112 closed Cleanup/optimization (invalid)

Schema Editor's add_field does not append "_id" to the foreign key column.

Reported by: Akash Agrawal Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords: Schema Editor, ForeignKey
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

While adding a new field via schema editor, I have to specifically add "_id" to the ForeignKey's column attribute. But when we create a foreign key normally, Django automatically adds this.

Change History (1)

comment:1 by Mariusz Felisiak, 4 years ago

Resolution: invalid
Status: newclosed
Summary: Schema Editor's add_field does not append "_id" to the foreign key columnSchema Editor's add_field does not append "_id" to the foreign key column.
Version: 2.2master

When you create a field dynamically, you should call field.set_attributes_from_name(...) to set these kind of attributes.

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