[Django] #31112: Schema Editor's add_field does not append "_id" to the foreign key column

7 views
Skip to first unread message

Django

unread,
Dec 21, 2019, 10:16:27 AM12/21/19
to django-...@googlegroups.com
#31112: Schema Editor's add_field does not append "_id" to the foreign key column
-------------------------------------+-------------------------------------
Reporter: Akash | Owner: nobody
Agrawal |
Type: | Status: new
Cleanup/optimization |
Component: Database | Version: 2.2
layer (models, ORM) | Keywords: Schema Editor,
Severity: Normal | ForeignKey
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/31112>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 21, 2019, 2:23:50 PM12/21/19
to django-...@googlegroups.com
#31112: Schema Editor's add_field does not append "_id" to the foreign key column.
-------------------------------------+-------------------------------------
Reporter: Akash Agrawal | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: Schema Editor, | Triage Stage:
ForeignKey | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* status: new => closed
* version: 2.2 => master
* resolution: => invalid


Comment:

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

--
Ticket URL: <https://code.djangoproject.com/ticket/31112#comment:1>

Reply all
Reply to author
Forward
0 new messages