Skip to main content

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.

Installation

PyPI

pip install django-project-home-templatetags

GitHub (development branch)

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

Configuration

Add project_home_tags to INSTALLED_APPS in settings.py:

INSTALLED_APPS = (
    ...
    'project_home_tags',
)

Specify the PROJECT_HOME_NAMESPACE in settings.py:

PROJECT_HOME_NAMESPACE = 'project_name:index_view'

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

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:

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:

{% 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.

{% load project_home %}

<a href="{% project_home_url %}">Home</a>

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

<a href="{% url 'project_name:index_view' %}">Home</a>

{% project_home_breadcrumb_bs3 %}

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

{% load project_home %}

<ol class="breadcrumb">
  {% project_home_breadcrumb_bs3 %}    {# <--- #}
  <li><a href="{% url 'app:namespace' %}">List of Objects</a></li>
  <li class="active">Object Detail</li>
</ol>

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

<ol class="breadcrumb">
  <li><a href="{% url 'project_name:index_view' %}">Home</a></li>    {# <--- #}
  <li><a href="{% url 'app:namespace' %}">List of Objects</a></li>
  <li class="active">Object Detail</li>
</ol>

{% project_home_breadcrumb_bs4 %}

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

{% load project_home %}

<ol class="breadcrumb">
  {% project_home_breadcrumb_bs4 %}    {# <--- #}
  <li class="breadcrumb-item" aria-label="breadcrumb"><a href="{% url 'app:namespace' %}">List of Objects</a></li>
  <li class=" breadcrumb-item active" aria-label="breadcrumb" aria-current="page">Object Detail</li>
</ol>

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

<ol class="breadcrumb">
  <li class="breadcrumb-item" aria-label="breadcrumb"><a href="{% url 'project_name:index_view' %}">Home</a></li>    {# <--- #}
  <li class="breadcrumb-item" aria-label="breadcrumb"><a href="{% url 'app:namespace' %}">List of Objects</a></li>
  <li class=" breadcrumb-item active" aria-label="breadcrumb" aria-current="page">Object Detail</li>
</ol>

Version 0.2.1

Revision History

0.2.1 2018-12-09

  • Don’t modify home_namespace globally

  • Exclude .pyc files from distribution

0.2.0 2018-12-08

  • Allow settings.PROJECT_HOME_NAMESPACE to be an actual URL, rather than just an internal namespace

0.1.0 2018-11-20

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

Release files for django-project-home-templatetags 0.2.1

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-project-home-templatetags 0.2.1
File Size Uploaded
django-project-home-templatetags-0.2.1.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-project-home-templatetags 0.2.1
File Interpreter ABI Platform
django_project_home_templatetags-0.2.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 11.1 kB

Release files / django-project-home-templatetags-0.2.1.tar.gz

Download URL django-project-home-templatetags-0.2.1.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4fd357e8a16607015edaaa473c99f45c6dd8742bafd8ae2363ac19d3bc17676c
BLAKE2b-256 checksum
How to use checksums
16b050a45fedeed1dcee271356f2b8cf680e75648947317a69749231ae642f5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

Release files / django_project_home_templatetags-0.2.1-py2.py3-none-any.whl

Download URL django_project_home_templatetags-0.2.1-py2.py3-none-any.whl
Size 5.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ee73dd6a5f4cc0f6299cee17089636d06ab6e328c1cf14a37b8e0287d84a5aa7
BLAKE2b-256 checksum
How to use checksums
7b5586bb1873a7af1139b0b3864d56659c0ccdb072d436b109583bd8ed9926a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

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