Allows easy creation of template tags that define a context variable
Project description
Allows easy creation of template tags that define a context variable
The "tag function" returns a value which, when called inside a template, is stored in a
variable or displayed directly.
Example:
@definition_tag(register=register)
def top_players(context):
return TopScores.objects.order_by('-elo')[:20]
Inside the template, we could call {% top_players %} to output the data, or we could call
{% top_players as foo %} {{ foo }}.
The "tag function" returns a value which, when called inside a template, is stored in a
variable or displayed directly.
Example:
@definition_tag(register=register)
def top_players(context):
return TopScores.objects.order_by('-elo')[:20]
Inside the template, we could call {% top_players %} to output the data, or we could call
{% top_players as foo %} {{ foo }}.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-definition-tag-0.1.0.tar.gz
.
File metadata
- Download URL: django-definition-tag-0.1.0.tar.gz
- Upload date:
- Size: 1.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
dd009340c2bed7fb50e2c6eb13671fb083804366234e6c5cd7a4b8dbefdfc089
|
|
MD5 |
fef9b0088036cad598c3255e0eaae0f0
|
|
BLAKE2b-256 |
3487be0212af10cef11d268225a49a24378eb3efac88dbd0d665a7b78939c470
|