Feature request: Comments in Django models saved to database schema
|Reported by:||Renato Alves||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.2|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Currently there is no way to make comments in the schema via Django. The only way is to alter the tables and add the comments manually in the database.
This feature request presents one possible implementation.
For comments at the table level, use the first line of the Model docstring, truncating it depending on backend limitations.
For comments at the column level, include a comment attribute on the Field declaration.
class Dummy(Model): """This comment goes into the schema. This and the following won't ... """ dummy_name = CharField(max_length=20, comment="All dummies should have names right?") ...
In addition, a specific syntax could be used in the docstring to prevent undesired comments in already existing code to be transfered to the database.
Change History (8)
comment:3 Changed 6 years ago by
|Summary:||Feature request: docstring and comments in Django models saved to database schema → Feature request: Comments in Django models saved to database schema|
comment:7 Changed 5 years ago by
|Status:||new → closed|