Changes between Version 42 and Version 43 of BackwardsIncompatibleChanges


Ignore:
Timestamp:
Nov 26, 2005, 5:21:39 PM (19 years ago)
Author:
Adrian Holovaty
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BackwardsIncompatibleChanges

    v42 v43  
    369369== Changed the way custom template tags and filters are registered ==
    370370
    371 As of [], we changed the way custom template tags and filters are registered. If you've written custom template tags or filters, you'll need to make a small change to the way they're registered.
    372 
    373 Old way:
    374 {{{
    375 from django.core import template
    376 
     371As of [], we changed the way custom template tags and filters are registered. If you've written custom template tags or filters, you'll need to make a couple of changes:
     372
     373=== Filter arguments ===
     374
     375For any filters that don't take an argument, remove the second argument to the filter function.
     376
     377Old:
     378{{{
    377379def lower(param, _):
    378380    return param.lower()
     381}}}
     382
     383New:
     384{{{
     385def lower(param):
     386    return param.lower()
     387}}}
     388
     389The system now introspects the function's arguments to find out whether a filter argument is required.
     390
     391=== Change the way your tags/filters are registered ===
     392
     393Old way:
     394{{{
     395from django.core import template
    379396
    380397template.register_filter('lower', lower, False)
     
    386403{{{
    387404from django.core import template
    388 
    389 def lower(param): # If a filter takes no arguments, leave off the argument.
    390     return param.lower()
    391405
    392406register = template.Library()
     
    395409}}}
    396410
    397 A new decorator syntax is also supported.
     411=== Change template decorator calls ===
     412
     413If you're using the undocumented template decorators (simple_tag and inclusion_tag), change your calls to be members of the library class.
     414
     415[INSERT EXAMPLE HERE]
    398416
    399417See [http://www.djangoproject.com/documentation/templates_python/#writing-custom-template-filters Writing custom template filters] and [http://www.djangoproject.com/documentation/templates_python/#writing-custom-template-tags Writing custom template tags] for full documentation.
Back to Top