Spectre CSS for Django
Project description
django-spectre-css
This Module uses spectre.css (https://picturepan2.github.io/spectre/) to style a Django application.
Installation
Install:
pip install django-spectre-css
To use include static/css/lib/\*.css
in your base templates css files or in your CSS pipeline
add it to your installed apps:
INSTALLED_APPS = [
'...',
'django-spectre-css',
]
Warning
The help_text from models is marked as save in the template and therefore it is possible to have html e.g. links in the help_text. This means that help_text of an ModelField should never be directly based on user input.
Examples:
This module defines the following tags to make displaying forms easier.
-
render the form header (csrf-token and non-field errors) for the form 'form':
{% load spectre_css %}
{% render_form_header form %} [...] -
render a field user of the form 'form':
{% extends base.html %} {% load spectre_css %}
[...] {% render_form_field form.user %}
-
render the whole form:
{% extends base.html %} {% load spectre_css %}
{% render_form form %} -
render the first two parts of a MultiValueField as independent Fields:
{% extends base.html %} {% load spectre_css %}
[...] {% render_form_field form.datetime 0 label_text="Date"%} {% render_form_field form.datetime 1 label_text="Time" %}
render_form_field
takes the following keyword arguments:
switch=True|False
for checkboxes, ifTrue
renders the checkbox as switchadd_choices=[(value,text),...]
to add the choices of an select to the selectreplace_choices=[(value,text),...]
to set the choices of an select manuallyempty_option=value
to generate an empty option if None is selected with the textvalue
(only select widgets)value=value
overwrites the initial value of the field (not Checkbox and Select) withvalue
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 django-spectre-css-0.2.dev2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6656aad2ab6a6d46195e50667d983ccf0562be26e2cacd47735af46f88b561a2 |
|
MD5 | 68cdb9b4436f95b2fb66444ad84646db |
|
BLAKE2b-256 | fdd34db9013468be692e28e9396e6dcb482b806c4c9c59205399d71541f19b2f |
Hashes for django_spectre_css-0.2.dev2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3f0a4748614922f7884eca08f2c70d3c6421e35b30d998375bd512d1d91f9e0 |
|
MD5 | 13a5322e99f96a85c63ae156e22920ef |
|
BLAKE2b-256 | 618901e21c4f3ebb9838895b8782c97aa0aa7c45738394b2f3c248b704bf3e25 |