FlaskでQuillリッチテキストエディタを簡単に使える拡張
Project description
Flask-Quill
Flask アプリで Quill リッチテキストエディタを簡単に使える拡張です。
インストール
pip install flask_quill
使い方
- Flask アプリに拡張を登録(Bootstrap5 も利用する場合)
from flask import Flask, render_template
from flask_quill import Quill
from flask_bootstrap import Bootstrap5
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret'
quill = Quill(app)
bootstrap5 = Bootstrap5(app)
- WTForms でフィールドを定義
from flask_wtf import FlaskForm
from wtforms import SubmitField
from wtforms.validators import DataRequired
from flask_quill.fields import QuillField
class PostForm(FlaskForm):
body = QuillField('本文', validators=[DataRequired()])
submit = SubmitField('送信')
- テンプレートでエディタを表示(Bootstrap5 の render_form を利用)
{{ quill.load() }}
{{ quill.config(name='body') }}
{{ render_form(form, novalidate=True, button_map={"submit": "primary"}) }}
- Bootstrap5 の render_form と組み合わせて使えます。
- Quill エディタの内容は自動的に textarea に反映され、サーバーに送信されます。
ライセンス
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
flask_quill-0.1.0.tar.gz
(3.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flask_quill-0.1.0.tar.gz.
File metadata
- Download URL: flask_quill-0.1.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6744d143b5bba9426b38fb91ab1bbd560f8e30e4f23e2f3cddcbf9c728a0b5a
|
|
| MD5 |
b7e5dbf62e901d93a152e1e78169f73c
|
|
| BLAKE2b-256 |
1a42ec1c416c49660d2d7bd4d76c6e9304a8161cb6eb6d0d146a479275b1a6f7
|
File details
Details for the file flask_quill-0.1.0-py3-none-any.whl.
File metadata
- Download URL: flask_quill-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64647bfdb5003d8804e60e84115a2bfee7442daa8589ea25641e3ccc909e00aa
|
|
| MD5 |
c65ff94a53ccead3ac4e76e5c251e392
|
|
| BLAKE2b-256 |
da6715573e26e142b023194354fae48d3a7dfdd2907946e70b8ca298579d7962
|