Skip to main content
# wagtail_materializecss

Style your wagtail pages with materializecss!

Run the demo project to see how it in action.

### Includes
* Demo project to show how you may want to style a page
* Component blocks
* Badge
* Breadcrumb
* Button
* Card
* Collection
* FAB
* Footer
* Icon
* links
* Navbar
* Preloader
* Scrollspy (table of contents)
* MaterializePage with base.html
* Default page variables to style the navbar and footer
* Additionally includes Abstract models Navbar and Footer
* Functions to get common components for StreamFields
* get_headings(exclude=None) - Return h1, h2, h3, h4, h5, h6 tags with scrollspy table of contetns support
* get_components(exclude=None) - Returns blocks for Card, Collection, Button, Icon, ...
* get_footer_blocks(exclude=None) - Returns common components that someone might want in a footer.


## Example Page

![Example Page](./example_page.PNG)

![Example Admin](example_admin.PNG)

```python
from django.db import models
from wagtail.core.fields import StreamField, RichTextField
from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel, MultiFieldPanel, FieldRowPanel
from wagtail.images.edit_handlers import ImageChooserPanel
from wagtail.core.blocks import RichTextBlock

from wagtail_materializecss.models import MaterializePage, get_headings, get_components
from wagtail_materializecss.components import Collection


class BloggerHomePage(MaterializePage):
author = models.CharField(max_length=255)
background_image = models.ForeignKey('wagtailimages.Image', on_delete=models.SET_NULL, null=True, related_name='+')
user_image = models.ForeignKey('wagtailimages.Image', on_delete=models.SET_NULL, null=True, related_name='+')

body = StreamField([
*get_headings(exclude=['h6']),
('paragraph', RichTextBlock(icon='pilcrow')),
('collection', Collection()),
*get_components(),
])

content_panels = MaterializePage.content_panels + [
MultiFieldPanel([
FieldPanel('author'),
ImageChooserPanel('background_image'),
ImageChooserPanel('user_image'),
], heading="Author Fields",),
FieldPanel('intro', classname="full"),
]
```

Template
```djangotemplate
{% extends "wagtail_materializecss/base.html" %}
{% load static wagtailcore_tags wagtailimages_tags wagtail_materializecss_tags %}

{% block body_class %}template-bloggerhomepage{% endblock %}

{% block before_container %}
<div class="row">
{% image page.background_image original as page_image %}
<div class='hero-image' style="background-image: url('{{ page_image.url }}')"></div>
</div>
{% endblock %}

{% block content %}
<div class="row">
<div class="col s12 m4 right" style="margin-top: 1rem;">
{% image page.user_image fill-200x200 class="responsive-img circle center-object" %}
<h3 class="center-object {{ page.color }}-text">{{ page.author }}</h3>
</div>
<div class="col s12 m8">
<h1 class="{{ page.color }}-text scrollspy">Introduction</h1>
{% include_block page.body %}
</div>
</div>

<div class="row">
<h5>Posts</h5>
<div class="divider"></div>
{% for post in blogpages %}
<div class="col s12 m6 l4">
{% make_link None "Go to Post" post.specific as post_link %}
{% make_card post.specific.title post.specific.description post_link size='small' %}
</div>
{% endfor %}
</div>
{% endblock %}
```

Release files for wagtail-materializecss 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wagtail-materializecss 0.0.6
File Size Uploaded
wagtail_materializecss-0.0.6.tar.gz 953.4 kB Details

Release files / wagtail_materializecss-0.0.6.tar.gz

Download URL wagtail_materializecss-0.0.6.tar.gz
Size 953.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1ee7b047ce14cb56f3df4514705b86408349ec92493ed6ee04af6caba5d6ab7e
BLAKE2b-256 checksum
How to use checksums
f8fc9bf4f6ed587e2c000747fe75a70c9c6e8b5a2b90e3905210901957a0a8a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.7.0

Release history Release notifications | RSS feed

This release

0.0.6 This release

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

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