Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Instructions

This is a reusable django app which adds some templatetags to django-taggit.

Installation

Just install django-taggit-templatetags via pip:

$ pip install django-taggit-templatetags

After installing and configuring django-taggit, just add taggit_templatetags to your INSTALLED_APPS in your settings.py:

INSTALLED_APPS = (
...
'taggit_templatetags',
...
)

Usage

Now there are some templatetags enabled, at the moment only to create lists of tags and tag-clouds.

In your templates, you need to load taggit_extras:

...
{% load taggit_extras %}
...

Taglists

After loading taggit_extras you can create a list of tags for the whole project (in the sense of djangoproject), for an app (in the sense of djangoapp), for a model-class (to get a list for an instance of a model, just use its tag-field).

For the tags of a project, just do:

{% get_taglist as tags %}

For the tags of an app, just do:

{% get_taglist as tags for 'yourapp' %}

For the tags of an model, just do:

{% get_taglist as tags for 'yourapp.yourmodel' %}

No matter what you do, you have a list of tags in the tags template variable. You can now iterate over it:

<ul>
{% for tag in tags %}
<li>{{tag}} ({{tag.num_times}})</li>
{% endfor %}
<ul>

As you can see, each tag has an attribute num_times which declares how many times it was used. The list of tags is sorted descending by num_times.

Inclusion-Tag

For convenience, there’s an inclusion-tag. It’s used analogue. For example, for a taglist of a model, just do:

{% include_taglist 'yourapp.yourmodel' %}

Tagclouds

A very popular way to navigate through tags is a tagcloud. This app provides some tags for that:

{% get_tagcloud as tags %}

or:

{% get_tagcloud as tags for 'yourapp' %}

or:

{% get_tagcloud as tags for 'yourapp.yourmodel' %}

respectivly. The resulting list of tags is ordered by their name attribute. Besides the num_items attribute, there’s a weight attribute. Its maximum and minimum may be specified as the settings section reads.

Inclusion-Tag

Even for the tagcloud there’s an inclusion-tag. For example, for a tagcloud of a model, just do:

{% include_tagcloud 'yourapp.yourmodel' %}

Settings

There are a few settings to be set:

TAGGIT_TAGCLOUD_MIN (default: 1.0)

This specifies the minimum of the weight attribute of a tagcloud’s tags.

TAGGIT_TAGCLOUD_MAX (default: 6.0)

This specifies the maximum of the weight attribute of a tagcloud’s tags.

If you want to use the weight as font-sizes, just do as follows:

<font size={{tag.weight|floatformat:0}}>{{tag}}</font>

So the weights are converted to integer values.

Thanks

Thanks to the python- and django-community, in particular to Alex Gaynor, the inventor of django-taggit and a wonderful guy to argue with.

Metadata

Release files for django-taggit-templatetags 0.3.0dev

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-taggit-templatetags 0.3.0dev
File Size Uploaded Provenance Actions
django-taggit-templatetags-0.3.0dev.tar.gz 6.2 kB Without provenance Details for django-taggit-templatetags-0.3.0dev.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-taggit-templatetags 0.3.0dev
File Interpreter ABI Platform Actions
django-taggit-templatetags-0.3.0dev.linux-x86_64.tar.gz Details for django-taggit-templatetags-0.3.0dev.linux-x86_64.tar.gz

Total release size: 14.6 kB

Release files / django-taggit-templatetags-0.3.0dev.tar.gz

Download URL django-taggit-templatetags-0.3.0dev.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cefb85a491271daee9c6739c55aca83d39893677a8ba37a4e6184609baedc03b
BLAKE2b-256 checksum
How to use checksums
42868fc03290e4bf3ed47548599454a9fbf2e2150bd79a18484707e88af15092
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django-taggit-templatetags-0.3.0dev.linux-x86_64.tar.gz

Download URL django-taggit-templatetags-0.3.0dev.linux-x86_64.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cafe9560146c0ffb3043d4a385f686e0ed10234d270549bea530ad9e2ef10e65
BLAKE2b-256 checksum
How to use checksums
2959d0fa0eba29a531fcecb175c233241319028b53ad294e02ba7dcc8f7111ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-taggit-templatetags 0.3.0dev

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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