Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

A simple Django form template tag to work with Materializecss

Project description

# materialize-css-form
Materializecss for Django Form

A simple Django template tag to work with [Materializecss](

## Install

pip install django-materializecss-form


[on pypi](
[on GitHub](



Add Materializecss to your project:

In your base.html:


{% block css %}
<link href="" rel="stylesheet">
<link rel="stylesheet" href="" integrity="sha256-qj3p6P1fJIV+Ndv7RW1ovZI2UhOuboj9GcODzcNFIN8=" crossorigin="anonymous" />
{% endblock css %}



<body >

{% block javascript %}

<script src="" integrity="sha256-SrBfGi+Zp2LhAvy9M1bWOCXztRU9Ztztxmu5BcYPcPE=" crossorigin="anonymous"></script>


// Initialize materialize data picker
$('.datepicker').datepicker({'format': 'yyyy-mm-dd'});



{% endblock javascript %}



## Usage

Use it like this, simple.

{% load materializecss %}

### All the form

{{ form|materializecss }}

### Individual field

{{ form.<<field name>> | materializecss }}

### Custom size (default is 's12')

{{ form|materializecss:'m6' }}

### Icons support
This is most useful for adding a descriptive icon when you are creating a custom layout by building the form one field at a time. Substitue FIELD_NAME below with one of the field names from your form.
{{ form.FIELD_NAME|materializecss:'s12 m6, icon=person' }}
{{ form.FIELD_NAME|materializecss:'custom_size=s12 m6, icon=person' }}

### Note about `DateTimeField`
Input field is rendered as a *datetime-local* type, this lets the user easily enter both a date and a time. As this field requires ISO-8601 format, your main project settings need to include the ISO format in order for the form to interpret this field valid:
from django.conf.global_settings import DATETIME_INPUT_FORMATS

# ISO 8601 datetime format to accept html5 datetime input values
DATETIME_INPUT_FORMATS += ["%Y-%m-%dT%H:%M:%S", "%Y-%m-%dT%H:%M"]

## Demo

![Basic form](



## Help

### Widget

- TextInput
- Textarea
- CheckboxInput
- RadioSelect
- Select
- SelectMultiple
- CheckboxSelectMultiple
- Filefield
- DateField
- DateTimeField

## Inspired by


## Originally Built By

Florent CLAPIÉ


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-materializecss-form-bacchus, version 1.1.12
Filename, size File type Python version Upload date Hashes
Filename, size django_materializecss_form_bacchus-1.1.12-py3-none-any.whl (10.4 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page