Skip to main content
Pre-release

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

Django Material Widgets

Easily convert your Django Forms and ModelForms to use widgets styled with Material Components for the Web.

status docs pypi pyversion license

Click to view demo

Quick Start

  1. Install Django Material Widgets:

    pip install django-material-widgets
  2. Add material_widgets to INSTALLED_APPS in your settings.py:

    INSTALLED_APPS = [
        ...
        'material_widgets',
    ]
  3. Edit your forms.py:

    • Import material_widgets.widgets.MaterialForm and/or material_widgets.widgets.MaterialModelForm:

      from material_widgets import MaterialForm, MaterialModelForm
    • Change forms using django.forms.Form and/or django.forms.ModelForm to MaterialForm or MaterialModelForm respectively:

      class MyForm(forms.Form): ⇨ class MyForm(MaterialForm):
      
      class MyModelForm(forms.ModelForm): ⇨ class MyModelForm(MaterialModelForm):
  4. Edit your HTML templates:

    • Change {{ form }} template variables to {{ form.as_components }}:

      {{ form.as_p }} ⇨ {{ form.as_components }}
    • Add {{ form.media.css }} to your <head> tag:

      <head>
          {{ form.media.css }}
      </head>
    • Add the mdc-typography CSS class to your <body> tag:

      <body class="mdc-typography">
    • Add {{ form.media.js }} to the bottom of your <body> tag:

      <body class="mdc-typography">
          ...
      
          {{ form.media.js }}
      </body>
    • (Optional) Add stylesheet links:

      <head>
          <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">
          <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
      </head>

Demo

https://ooknosi.github.com/django_material_widgets

To view the demo locally at http://localhost:8000:

git clone https://github.com/ooknosi/django_material_widgets.git
cd django_material_widgets/src
python manage.py migrate --settings=demo.settings
python manage.py runserver --settings=demo.settings

Documentation

http://django-material-widgets.readthedocs.io/en/latest/

Metadata

Release files for django-material-widgets 1.0.0b3

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-material-widgets 1.0.0b3
File Size Uploaded Provenance
django-material-widgets-1.0.0b3.tar.gz 452.8 kB Without provenance Details

Release files / django-material-widgets-1.0.0b3.tar.gz

Download URL django-material-widgets-1.0.0b3.tar.gz
Size 452.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5fb1e54968ea9605895697e67c4785ea95be342ba5c84f347136af6cd3f263d2
BLAKE2b-256 checksum
How to use checksums
3944368c7e18622fe790fd9ccebd84371ff63cc9d3ff11d2e9319d9b7f5a5c88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-material-widgets 1.0.0b3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release
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