Opened 6 years ago

Closed 6 years ago

#29756 closed Bug (fixed)

Missing information about model field name restriction

Reported by: zdpx Owned by: nobody
Component: Documentation Version: 2.1
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

Documentation available at https://docs.djangoproject.com/en/2.1/topics/db/models/#field-name-restrictions says, that there are only 2 restrictions on naming model fields:

  1. A field name cannot be a Python reserved word
  2. A field name cannot contain more than one underscore in a row

I've found another restriction: field name can't ends with underscore, because it generates error during making migrations:

 (fields.E001) Field names must not end with an underscore.

Change History (2)

comment:1 by zdpx, 6 years ago

Summary: Missing information aboutMissing information about model field name restriction

comment:2 by Tim Graham <timograham@…>, 6 years ago

Resolution: fixed
Status: newclosed

In d483a5f:

Fixed #29756 -- Doc'd that model field names can't end with an underscore.

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