Opened 6 years ago
Closed 6 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 , 6 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
| Summary: | Schema Editor's add_field does not append "_id" to the foreign key column → Schema Editor's add_field does not append "_id" to the foreign key column. |
| Version: | 2.2 → master |
Note:
See TracTickets
for help on using tickets.
When you create a field dynamically, you should call
field.set_attributes_from_name(...)to set these kind of attributes.