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
- Host: GitHub
- URL: https://github.com/mfcovington/django-project-home-templatetags
- Owner: mfcovington
- License: bsd-3-clause
- Created: 2018-11-21T06:51:21.000Z (over 6 years ago)
- Default Branch: develop
- Last Pushed: 2018-12-09T09:39:05.000Z (over 6 years ago)
- Last Synced: 2025-01-06T16:35:49.827Z (5 months ago)
- Topics: boostrap4, bootstrap, bootstrap3, breadcrumbs, django, template-tags, templatetags
- Language: Python
- Homepage: https://pypi.org/project/django-project-home-templatetags/
- Size: 18.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE
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 %}
If ``settings.PROJECT_HOME_NAMESPACE`` is defined as ``'project_name:index_view'``, this is equivalent to:
.. code-block:: python
``{% 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*