Skip to main content

DJANGO 数据库增强插件

Project description

DJANGO 数据库增强

Django Kelove Setting Version Python Version Django Version LICENSE

主要功能

  • 迁移支持写入表注释及字段注释

  • 迁移支持写入字段默认值

  • 在线数据库设计文档生成

  • CKFinder文件上传字段集成

  • CKEditor编辑器字段集成

  • Markdown编辑器字段集成

  • JSON字段集成

需要加载的应用模块

INSTALLED_APPS = [
    ...
    # 配置管理插件
    'django_kelove_setting',
    # 数据库增强插件
    'django_kelove_database',
    ...
]

需要添加的路由地址

from django.urls import path, include

urlpatterns = [
    ...
    # 数据库增强(主要用于ckfinder文件上传)
    path('database/', include('django_kelove_database.urls', namespace='django_kelove_database')),
    ...
]

MySQL配置示例

DATABASES = {
    'default': {
        'ENGINE': 'django_kelove_database.db.backends.mysql',
        'NAME': 'test',
        'USER': 'root',
        'PASSWORD': 'root',
        'HOST': '127.0.0.1',
        'PORT': 3306,
        # 'INCLUDE_DEFAULT': True,
        'INCLUDE_DEFAULT': lambda model, field, include_default, connection: False if field.db_parameters(
            connection=connection
        )['type'] in ['longtext', 'longblob'] else True,
        'OPTIONS': {'charset': 'utf8mb4'}
    }
}

扩展字段使用示例

from django.db import models

from django_kelove_database.db import fields


class FieldDemo(models.Model):

    json_field = fields.JSONField(verbose_name='JSON演示', blank=True, null=False, default=dict)

    ck_finder_field = fields.CkFinderField(verbose_name='文件上传', max_length=191, blank=True, null=False, default='')

    editor_md_field = fields.EditorMdField(verbose_name='Markdown编辑器', blank=True, null=False, default='')

    editor_ck_field = fields.EditorMdField(verbose_name='Ckeditor', blank=True, null=False, default='')

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

django_kelove_database-2.0.0-py3-none-any.whl (6.5 MB view details)

Uploaded Python 3

File details

Details for the file django_kelove_database-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_kelove_database-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 35ea5df24be8953ac4b89da312c3bfe0a39aee2b31701fa582eea6c480f70148
MD5 49e115100290d84e2829caa508d682fe
BLAKE2b-256 9c3d08d78895397a71fa9bc26ab5d8b20fdfbc1599ec692f06b40d0261c9fe66

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