Skip to main content

django-ace-widget

Django admin widget using ACE editor for TextField.

安装

pip install django-ace-widget

使用

app/admin.py

from django.db import models
from django.contrib import admin

from django_ace_widget.widgets import ace_widget
from .models import Page
from .models import Block


class BlockInline(admin.TabularInline):
    model = Block
    extra = 0
    formfield_overrides = {
        models.TextField: {
            # inline模式下,使用100%显示不友好,请使用px指定宽度。
            "widget": ace_widget("java", width="800px"),
        },
    }


class PageAdmin(admin.ModelAdmin):
    list_display = ["title"]
    formfield_overrides = {
        models.TextField: {
            "widget": ace_widget("python"),
        },
    }
    inlines = [
        BlockInline,
    ]


admin.site.register(Page, PageAdmin)

ace_widget参数

def ace_widget(
    language,
    theme="xcode",
    width="100%",
    minLines=15,
    maxLines=15,
):
    """创建AceWidget类。

    参数:
        language: 语言,如:html, java, python等。
        theme: 编辑器皮肤。默认为:xcode。
        width: 编辑器宽度。默认为:100%。可以设置为800px等。
        minLines: 初始行数。默认为:15。
        maxLines: 最大行数。默认为:15。

    返回值:
        AceWidget类

    """

ace皮肤

  • clouds
  • cobalt
  • eclipse
  • nord_dark
  • dawn
  • solarized_light
  • chaos
  • monokai
  • github
  • merbivore_soft
  • katzenmilch
  • chrome
  • tomorrow
  • clouds_midnight
  • tomorrow_night_blue
  • gob
  • gruvbox
  • xcode
  • textmate
  • iplastic
  • crimson_editor
  • tomorrow_night_bright
  • mono_industrial
  • merbivore
  • sqlserver
  • idle_fingers
  • ambiance
  • kuroir
  • pastel_on_dark
  • kr_theme
  • twilight
  • solarized_dark
  • tomorrow_night
  • terminal
  • dracula
  • one_dark
  • vibrant_ink
  • tomorrow_night_eighties
  • dreamweaver

版本记录

v0.1.0

  • 版本首发。

Metadata

Release files for django-ace-widget 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-ace-widget 0.1.0
File Size Uploaded Provenance Actions
django-ace-widget-0.1.0.tar.gz 9.4 kB Without provenance Details for django-ace-widget-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-ace-widget 0.1.0
File Interpreter ABI Platform Actions
django_ace_widget-0.1.0-py3-none-any.whl Python 3 none any Details for django_ace_widget-0.1.0-py3-none-any.whl

Total release size: 19.4 kB

Release files / django-ace-widget-0.1.0.tar.gz

Download URL django-ace-widget-0.1.0.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f7feb0b483ad7c529e0007b790ccf5e67960cce0ed85a0d1c2f4732d05d0c195
BLAKE2b-256 checksum
How to use checksums
12cbf3bf04f3ab8dcbdc175ab3d2ef8b62b3b649003c65c40b0f887b5ff445fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release files / django_ace_widget-0.1.0-py3-none-any.whl

Download URL django_ace_widget-0.1.0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0522f8cc96a437f73a29353d688bf68ac6c4963642acfe1e41e7ee940c2781c9
BLAKE2b-256 checksum
How to use checksums
4d4c38a80aa269ffbcd22d6c24c8eb78b53e10a77db1b8350b60e11b1f530b6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Security for django-ace-widget 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page