An app that provides Django model comment migration
English | 简体中文
- Automatic migration model help_text to comment [Support customization]
- Automatically migrate the verbose_name of the model to the table comment [Support customization]
- Provide a command to migrate the comment of the specified app
download python package:
pip install django-comment-migrate
add django_comment_migrate app
project/project/settings.py
INSTALLED_APPS =[ "django_comment_migrate", ... ]
add model
project/app/model.py
from django.db import models class CommentModel(models.Model): no_comment = models.TextField() aaa = models.IntegerField(default=0, help_text="test default") help_text = models.CharField(max_length=40, help_text="this is help text") class Meta: app_label = 'tests' db_table = 'comment_model' verbose_name = 'It is Comment Table'
add app
project/app/settings.py
DCM_COMMENT_APP=["app"]
execute database migrate:
python manage.py makemigrations python manage.py migrate
Now check the database table, comments have been generated.
In settings.py:
DCM_COMMENT_KEY='verbose_name' DCM_TABLE_COMMENT_KEY='verbose_name' DCM_BACKEND={ "new-engine": "engine.path" } DCM_COMMENT_APP=["app"]
Provides a comment migration command, which allows the database to regenerate comments:
python manage.py migratecomment [app_label]
The command needs to be executed after all migrations are executed
Install Tox:
pip install tox
Run:
tox
- MySQL
- PostgreSQL
- Microsoft SQL Server