An open API service indexing awesome lists of open source software.

https://github.com/mfcovington/django-project-home-templatetags

A collection of Django templatetags to flexibly incorporate links and breadcrumbs from app pages to the homepage of a project
https://github.com/mfcovington/django-project-home-templatetags

boostrap4 bootstrap bootstrap3 breadcrumbs django template-tags templatetags

Last synced: 4 months ago
JSON representation

A collection of Django templatetags to flexibly incorporate links and breadcrumbs from app pages to the homepage of a project

Awesome Lists containing this project

README

        

********************************
django-project-home-templatetags
********************************

``django-project-home-templatetags`` is a collection of Django templatetags to flexibly incorporate links and breadcrumbs from app pages to the homepage of a project.

If ``PROJECT_HOME_NAMESPACE`` is not defined to ``settings.py``, these template tags are silenced.

Source code is available on GitHub at `mfcovington/django-project-home-templatetags `_.

.. contents:: :local:

Installation
============

**PyPI**

.. code-block:: sh

pip install django-project-home-templatetags

**GitHub (development branch)**

.. code-block:: sh

pip install git+http://github.com/mfcovington/django-project-home-templatetags.git@develop

Configuration
=============

Add ``project_home_tags`` to ``INSTALLED_APPS`` in ``settings.py``:

.. code-block:: python

INSTALLED_APPS = (
...
'project_home_tags',
)

Specify the ``PROJECT_HOME_NAMESPACE`` in ``settings.py``:

.. code-block:: python

PROJECT_HOME_NAMESPACE = 'project_name:index_view'

Rather than using an internal namespace, you can also set ``PROJECT_HOME_NAMESPACE`` to a specific URL:

.. code-block:: python

PROJECT_HOME_NAMESPACE = 'djangoproject.com'

By default, a link created with a ``project_home_tags`` template tag has 'Home' as its text. This can be overridden by defining an optional project-wide label with ``PROJECT_HOME_LABEL`` in ``settings.py``:

.. code-block:: python

PROJECT_HOME_LABEL = 'Homepage' # Optional; Default is 'Home'

Both the default and the project-wide label can be overridden by passing a string to the template tag. For example:

.. code-block:: python

{% project_home_breadcrumb_bs4 'Custom Label' %}

Template Tags
=============

``{% load project_home %}``
--------------------------------

Loads the project home template tags in your Django template.

``{% project_home_url %}``
--------------------------

A template tag to return the project's home URL.

.. code-block:: python

{% load project_home %}

Home

If ``settings.PROJECT_HOME_NAMESPACE`` is defined as ``'project_name:index_view'``, this is equivalent to:

.. code-block:: python

Home

``{% project_home_breadcrumb_bs3 %}``
-------------------------------------

A template tag to return the project's home URL and label formatted as a `Bootstrap 3 breadcrumb `_.

.. code-block:: python

{% load project_home %}

If ``settings.PROJECT_HOME_NAMESPACE`` is defined as ``'project_name:index_view'``, this is equivalent to:

.. code-block:: python

``{% project_home_breadcrumb_bs4 %}``
-------------------------------------

A template tag to return the project's home URL and label formatted as a `Bootstrap 4 breadcrumb `_.

.. code-block:: python

{% load project_home %}

If ``settings.PROJECT_HOME_NAMESPACE`` is defined as ``'project_name:index_view'``, this is equivalent to:

.. code-block:: python

*Version 0.2.1*