Changes between Initial Version and Version 1 of Ticket #911
- Timestamp:
- Nov 25, 2005, 3:45:20 PM (19 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #911 – Description
initial v1 9 9 At the top of a tag/filter library, 10 10 do 11 11 {{{ 12 12 import django.core.template 13 13 14 14 register = template.Library() 15 15 }}} 16 16 then to register tags or filters, use 17 17 {{{ 18 18 register.tag('name', func) 19 19 register.filter('name', func, False) 20 20 }}} 21 21 In tags, resolve_variable_with_filters is gone. 22 22 The functionality is split in two. 23 23 In your compile function, do 24 24 {{{ 25 25 filter_expr = parser.compile(filter_string) 26 26 }}} 27 27 pass this into your node class as usual. 28 28 29 29 in render, do 30 30 {{{ 31 31 filter_result = filter_expr.resolve(context) 32 32 }}} 33 33 instead of resolve_variable_with_filters. 34 34 35 the tag decorators are also now members of the library class, so do 35 the tag decorators are also now members of the library class, so do 36 {{{ 36 37 @register.simple_tag 38 }}} 37 39 38 40 and 39 41 {{{ 40 42 @register.inclusion_tag('cow_detail') 41 43 }}} 42 44 for those. 43 45