Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Internet > Django Plugins

    django-classy-tags 0.4

    Download button

    No screenshots available
    Downloads: 305  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Jonas Obrist | More programs
    BSD License / FREE
    August 13th, 2011, 06:28 GMT
    ROOT / Internet / Django Plugins

     Read user reviews (0)  Refer to a friend  Subscribe

    django-classy-tags description

    Class based template tags for Django

    django-classy-tags's goal 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.

    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, no_resolve=True)
     )

     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.


    Product's homepage

    Here are some key features of "django-classy-tags":

    · Class based template tags.
    · Template tag argument parser.
    · Declarative way to define arguments.
    · Supports (theoretically infinite) parse-until blocks.
    · Extensible!

    Requirements:

    · Python
    · Django

      


    TAGS:

    templating infrastructure | template tags | Django | templating | tags

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM