[Answer]-The field name of OneToOneField field is append `_id` after the variable name

1👍

Django appends the _id for you in case of referential model fields.

From the documentation of Database Representation of a model field:

Behind the scenes, Django appends “_id” to the field name to create its database column name.
You can change this explicitly by specifying db_column
However, your code should never have to deal with the database column
name, unless you write custom SQL. You’ll always deal with the field
names of your model object.

So, just rename your field to personnel and the _id would be added by django for you.

Leave a comment