Package: django-materialize-nav
This library was created to make django work with materializecss.SetupInstall the library.# project/settings.pyINSTALLED_APPS=["materialize_nav",...]Setup Context ProcessorsMaterialize nav comes with a context processor to use some settings to change the default base styling.# Context Processor to work with settingsTEMPLATES=[{...'OPTIONS':{'context_processors':[...'materialize_nav.context_processors.get_context',],},},]Alternative way to get the standard context for views# views.pyfrommaterialize_nav.context_processorsimportget_contextdefshow_page(request):# Get the context with the style settingscontext=get_context(site_name='demo',title='Basic Content',primary_color='teal')context["object"]="MyObject"returnrender(request,"my_page.html",context)StyleThe base template can be used by extending the materialize base nav.{% extends "materialize_nav/base.html" %}


{% block nav_items %}<li><ahref="sass.html">Sass</a></li><li><ahref="badges.html">Components</a></li><li><ahref="collapsible.html">JavaScript</a></li>{% endblock %}


{% block sidenav_items %}
    {# One option is to override "materialize_nav/sidenav_items.html" #}
    {# OR use "block sidenav_items" and list your items or include another template. #}
    {# This makes the sidenav items reusable in other templates #}
    {% include "my_app/sidenav_items.html" %}
{% endblock %}


{% block contents %}<divclass="row"><divclass="col s12 m9 l10"><p>My Content goes here</p></div></div>{% endblock %}Styling controlsMaterialize nav comes with several style options used in the template context variables listed below.MATERIALIZE_SITE_NAMEMATERIALIZE_TITLEHIDE_CONTAINERSHOW_SIDENAVFIXED_SIDENAVPRIMARY_COLORSECONDARY_COLORPRIMARY_COLOR_LIGHTPRIMARY_COLOR_DARKSUCCESS_COLORERROR_COLORLINK_COLORIf you went through theSetup Context Processorsstep then you can modify several settings to change the default style.
This is an alternative to manually providing all of the template context variables.# settings.pyMATERIALIZE_SITE_NAME=None# Display this name in the navbar as the main nameMATERIALIZE_TITLE=None# This is the page title displayed as the browser tab nameMATERIALIZE_HIDE_CONTAINER=False# If True make the page take up the full widthMATERIALIZE_SHOW_SIDENAV=True# If True have a menu button available to open up the side navigation menuMATERIALIZE_FIXED_SIDENAV=False# If True and SHOW_SIDENAV make the side navigation menu always showingMATERIALIZE_PRIMARY_COLOR='materialize-red lighten-2'MATERIALIZE_SECONDARY_COLOR='teal'MATERIALIZE_PRIMARY_COLOR_LIGHT='#e51c23'MATERIALIZE_PRIMARY_COLOR_DARK=NoneMATERIALIZE_SUCCESS_COLOR=NoneMATERIALIZE_ERROR_COLOR=NoneMATERIALIZE_LINK_COLOR=NoneUSER_THUMBNAIL_PROPERTY='profile.thumbnail'# For user.profile.thumbnailUSER_BACKGROUND_PROPERTY='profile.background'# For user.profile.background# USER_THUMBNAIL = 'accounts/default_user.png'  # This is a default image# USER_BACKGROUND_IMAGE = 'accounts/default_user.png'  # This is a default imageStyling processThere are two methods for changing the default coloring for Materialize CSS.The old method is to use the templatetaginclude_dynamic_csswhich would use the django template system to generate
a style tag with the proper css classes overridden.The new method only requires using thebase.html. It includes thematerialize_nav/materialize_nav_colors.jsfile which uses javascript to create a style tag to edit the proper css classes. This method should require less
work from django to change the style.GoalsMy original goal was to create an easier way to use materialize css with django. When I first started forms did not
format properly and I thought navigation was a pain. Unfortunately, my original approach made this library a strong
coupled to your django app which was a terrible design decision. I am trying to simplify this library to help style
django apps quickly and without a lot of settings.