django-classy-tags 0.5.1
pip install django-classy-tags==0.5.1
Released:
Class based template tags for Django
Navigation
Verified details
These details have been verified by PyPIOwner
Maintainers
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: BSD License (UNKNOWN)
- Author: Jonas Obrist
Classifiers
- Development Status
- Framework
- Intended Audience
- License
- Natural Language
- Operating System
- Programming Language
- Topic
Project description
Please refer to the documentation in the docs/ directory for help. For a HTML rendered version of it please see here.
About this project
The goal of this project is to create a new way of writing Django template tags which is fully compatible with the current Django templating infrastructure. This new way should be easy, clean and require as little boilerplate code as possible while still staying as powerful as possible.
Features
Class based template tags.
Template tag argument parser.
Declarative way to define arguments.
Supports (theoretically infinite) parse-until blocks.
Extensible!
For the impatient
This is how a tag looks like using django-classy-tags:
from classytags.core import Tag, Options from classytags.arguments import Argument from django import template register = template.Library() class Hello(Tag): options = Options( Argument('name', required=False, default='world'), 'as', Argument('varname', required=False, resolve=False) ) def render_tag(self, context, name, varname): output = 'hello %s' % name if varname: context[varname] = output return '' return output register.tag(Hello)
That’s your standard hello world example. Which can be used like this:
{% hello %}: Outputs hello world
{% hello "classytags" %}: Outputs hello classytags
{% hello as myvar %}: Outputs nothing but stores hello world into the template variable myvar.
{% hello "my friend" as othervar %}: Outputs nothing but stores hello my friend into the template variable othervar.
Project details
Verified details
These details have been verified by PyPIOwner
Maintainers
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: BSD License (UNKNOWN)
- Author: Jonas Obrist
Classifiers
- Development Status
- Framework
- Intended Audience
- License
- Natural Language
- Operating System
- Programming Language
- Topic
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-classy-tags-0.5.1.tar.gz
.
File metadata
- Download URL: django-classy-tags-0.5.1.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
d23eb74afc51e1eb393703838459c0424ba64dd203fc4cca26f7f1715717860f
|
|
MD5 |
b514edc23d469b0f545be104ab07bcaf
|
|
BLAKE2b-256 |
4b6bfe605042d1343dd058c1c75a088544673e49fdfeca18565dcae16a0b215d
|