Changes between Version 42 and Version 43 of BackwardsIncompatibleChanges
- Timestamp:
- Nov 26, 2005, 5:21:39 PM (19 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
BackwardsIncompatibleChanges
v42 v43 369 369 == Changed the way custom template tags and filters are registered == 370 370 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 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 couple of changes: 372 373 === Filter arguments === 374 375 For any filters that don't take an argument, remove the second argument to the filter function. 376 377 Old: 378 {{{ 377 379 def lower(param, _): 378 380 return param.lower() 381 }}} 382 383 New: 384 {{{ 385 def lower(param): 386 return param.lower() 387 }}} 388 389 The 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 393 Old way: 394 {{{ 395 from django.core import template 379 396 380 397 template.register_filter('lower', lower, False) … … 386 403 {{{ 387 404 from django.core import template 388 389 def lower(param): # If a filter takes no arguments, leave off the argument.390 return param.lower()391 405 392 406 register = template.Library() … … 395 409 }}} 396 410 397 A new decorator syntax is also supported. 411 === Change template decorator calls === 412 413 If 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] 398 416 399 417 See [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.