Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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',
    'widget_tweaks',
]

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, if True renders the checkbox as switch
  • add_choices=[(value,text),...] to add the choices of an select to the select
  • replace_choices=[(value,text),...] to set the choices of an select manually
  • empty_option=value to generate an empty option if None is selected with the text value (only select widgets)
  • value=value overwrites the initial value of the field (not Checkbox and Select) with value

Upgrades

From < 0.3

'django-spectre-css' has to be changed into 'django_spectre_css' in th INSTALLED_APPS in Django settings.py

Metadata

Release files for django-spectre-css 0.3.dev2

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-spectre-css 0.3.dev2
File Size Uploaded
django_spectre_css-0.3.dev2.tar.gz 22.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-spectre-css 0.3.dev2
File Interpreter ABI Platform
django_spectre_css-0.3.dev2-py3-none-any.whl Python 3 none any Details

Total release size: 52.0 kB

Release files / django_spectre_css-0.3.dev2.tar.gz

Download URL django_spectre_css-0.3.dev2.tar.gz
Size 22.7 kB
Tags Source
SHA-256 checksum
How to use checksums
724852343ecf2ffadcffe8423c76d685c89371fff5c76444bcb067def0a40efa
BLAKE2b-256 checksum
How to use checksums
1731cac2f22052b21c00cbb5664a94809160974c38fdbc11076b561346c6375a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.16

Release files / django_spectre_css-0.3.dev2-py3-none-any.whl

Download URL django_spectre_css-0.3.dev2-py3-none-any.whl
Size 29.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2aba7a33a128461bdfc4b9d779527a2c204d84c336dfd35e7a3942169570150
BLAKE2b-256 checksum
How to use checksums
fbe13367c5b819985fffee59ad90a5f61ffc2376cdcf7b3d89451b09289c81e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.16
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