Feature request: Comments in Django models saved to database schema
|Reported by:||rjalves||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:1 Changed 4 years ago by lrekucki
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:3 Changed 4 years ago by rjalves
- Summary changed from Feature request: docstring and comments in Django models saved to database schema to Feature request: Comments in Django models saved to database schema
comment:4 Changed 4 years ago by brodie
- Triage Stage changed from Unreviewed to Design decision needed
comment:7 Changed 2 years ago by aaugustin
- Easy pickings unset
- Resolution set to wontfix
- Status changed from new to closed
- UI/UX unset