Ticket #5567: filter-last.2.diff
File filter-last.2.diff, 1.3 KB (added by , 17 years ago) |
---|
-
django/template/defaultfilters.py
431 431 return value[0] 432 432 except IndexError: 433 433 return u'' 434 first.is_safe = True434 first.is_safe = False 435 435 436 def last(value): 437 "Returns the last item in a list" 438 try: 439 return value[-1] 440 except IndexError: 441 return u'' 442 last.is_safe = False 443 436 444 def join(value, arg): 437 445 """Joins a list with a string, like Python's ``str.join(list)``.""" 438 446 try: -
tests/regressiontests/defaultfilters/tests.py
508 508 u'123' 509 509 >>> striptags(123) 510 510 u'123' 511 >>> last([0, 1, 2, 3, 4]) 512 4 513 >>> last(u'Hello') 514 u'o' 511 515 512 516 """ 513 517 -
docs/templates.txt
1403 1403 1404 1404 Joins a list with a string, like Python's ``str.join(list)``. 1405 1405 1406 last 1407 ~~~~ 1408 1409 Returns the last item in a list. 1410 1406 1411 length 1407 1412 ~~~~~~ 1408 1413