Changes between Version 20 and Version 21 of NewAdminChanges


Ignore:
Timestamp:
Nov 6, 2005, 5:42:30 PM (19 years ago)
Author:
ian@…
Comment:

added more detail about template tag decorators

Legend:

Unmodified
Added
Removed
Modified
  • NewAdminChanges

    v20 v21  
    207207If anyone has a better suggestion of how to deal with this, let me know.
    208208
    209 Template tag decorators see #625 . This can make defining some template tags very easy.
     209=== Template Tag decorators ===
     210defining tags in the 'standard' branch requires you to parse the string the user enters, and can be quite daunting for a newbie.
     211
     212In the new-admin branch you can now create a tag for use in your templates by simply doing the following:
     213{{{
     214from django.core.template.decorators import simple_tag
     215...
     216...
     217def monkey_tag(verb):
     218    return "I %s no evil" % verb
     219monkey_tag = simple_tag(monkey_tag)
     220
     221}}}
     222
     223you would then just load the tag library in your page like
     224{{{
     225{% load monkey %}
     226{% monkey_tag "hear" %}
     227}}}
     228
     229Template tag decorators see #625 goes into more detail. 
    210230
    211231== Admin converted to separate templates ==
Back to Top