Skip to main content

An app that provides Django model comment migration

Project description

Build https://pypi.org/project/django-comment-migrate/

An app that provides Django model comment migration

English | 简体中文

Feature

  • 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

Examples

  1. download python package:

    pip install django-comment-migrate
  2. add django_comment_migrate app

    project/project/settings.py

    INSTALLED_APPS =[
        "django_comment_migrate",
        ...
    ]
  3. 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'
  4. execute database migrate:

    python manage.py makemigrations
    python manage.py migrate

Now check the database table, comments have been generated.

Custom config

In settings.py:

DCM_COMMENT_KEY='verbose_name'
DCM_TABLE_COMMENT_KEY='verbose_name'
DCM_BACKEND={
        "new-engine": "engine.path"
}

Command

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

Running the tests

  1. Install Tox:

    pip install tox
  2. Run:

    tox

Supported Database

  • MySQL

  • PostgreSQL

  • Microsoft SQL Server

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-comment-migrate-0.1.5.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_comment_migrate-0.1.5-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file django-comment-migrate-0.1.5.tar.gz.

File metadata

  • Download URL: django-comment-migrate-0.1.5.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for django-comment-migrate-0.1.5.tar.gz
Algorithm Hash digest
SHA256 60119aadf9e90cc1e946b927ba60531391b8c69674ad163747b4d8d4421a2365
MD5 00b470dfc9100c94c00f550147a91e94
BLAKE2b-256 44b583a20beb1589a9f625c33e97c8cb91920e5ac91b250ed49128bbdc2697c2

See more details on using hashes here.

File details

Details for the file django_comment_migrate-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: django_comment_migrate-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for django_comment_migrate-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b1cf85d1c5750f20f27c87a8001b8dc44a83a52527b7a4eae1c6746184ab5cca
MD5 16fd460b014f3d23d89dddb196a8339f
BLAKE2b-256 b2b8fd1748260b9c5f0746cfdda8d2c7af72cd7bd902932cb63343600cde141e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page