Skip to main content

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

Project description

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'

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.1.0

Revision History

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

django_project_home_templatetags-0.1.0-py2.py3-none-any.whl (13.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-project-home-templatetags-0.1.0.tar.gz.

File metadata

  • Download URL: django-project-home-templatetags-0.1.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for django-project-home-templatetags-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8fb4f2b93d8f0becd434ed3516824fc0084f80b2ad551ed98aec1478fb92da34
MD5 50464a50d3729f11fa212f0e678e42cf
BLAKE2b-256 c30936dfcef41ab06ed5e55d1d3f949b1a1d508a3741acc3e86182b0844eb98e

See more details on using hashes here.

File details

Details for the file django_project_home_templatetags-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_project_home_templatetags-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 944c35fc8c00f7e209eb2585208d399be31a9101b13b5ccbe31174326968c493
MD5 73d406548fe678c072ae7694ad85fa4a
BLAKE2b-256 b65ad35e62aded890fa0fb1df77fef58aedfddd4a2626c0514dfb5819c1362de

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page