Flask extension to allow easy embedding of Fomantic-UI CSS Framework.
Project description
Flask-FomanticUI
Flask-FomanticUI is a collection of Jinja macros for Fomantic UI and Flask for the global style. Very similar to Bootstrap-Flask.
Features
- Table generation: Render data objects (dict or class objects) to Fomantic UI Table.
- Paginate generation: Render Flask-SQLAlchemy
Pagination
object to Fomantic UI Pagination. - Form generation: Render Flask-WTF/WTForms form object to Fomantic UI Form, etc.
Requirements
Python 3.8+
Dependecies for this project.
- Flask(>=2.0.2) for build the backend.
intallation
You can install via pip:
$> pip install Flask-FomanticUI
Example
Register the extension:
from flask import Flask
# To follow the naming rule of Flask extension, although
# this project's name is Flask-FomanticUI, the actual package
# installed is named `flask_fomanticui`.
from flask_fomanticui import FomanticUI
app = Flask(__name__)
fomantic = FomanticUI(app)
Assuming you have a Flask-WTF form like this:
class LoginForm(FlaskForm):
username = StringField('Username', validators=[DataRequired(), Length(1, 20)])
password = PasswordField('Password', validators=[DataRequired(), Length(8, 150)])
submit = SubmitField()
remember = BooleanField('Remember me')
Now with the render_form
macro:
{% from 'fomanticui/form_ui.html' import render_ui_form %}
<html>
<head>
<!-- Fomantic UI - CSS -->
</head>
<body>
<h2>Login</h2>
{{ render_ui_form(form) }}
<!-- Fomantic UI - JS -->
</body>
</html>
You will get a form like this with only one line code (i.e. {{ render_ui_form(form) }}
):
When the validation fails, the error messages will be rendered with proper style:
Read the Basic Usage docs for more details.
Links
Authors
- Ferreira, Juan David
Please submit bug reports, suggestions for improvements and patches via the (E-mail: juandavid9a0@gmail.com).
Contributors
Credits goes to these peoples:
Official repository and Issues
License
Flask-FomanticUI
is free software you can redistribute it and/or modify it
under the terms of the MIT License. For more information, you can see the
LICENSE file
for details.
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
Built Distribution
Hashes for Flask_FomanticUI-0.0.1a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5774ea696b12dae831ee85bce8609d2cfe88599f17b0206f6a60c8ed8777cc1 |
|
MD5 | cd7f7c0f554ed655f7065a3a59b90a7a |
|
BLAKE2b-256 | 3212fa29f1b51998d736404da898978d41542df2eb7517203e7c06fe8d81a21f |