make sure that blank strings do not kill in_list

This commit is contained in:
Thomas Woolford 2012-09-12 14:15:15 +09:30
parent 3785ca4477
commit 637130b2da

View File

@ -18,7 +18,7 @@ Assuming 'food' = 'pizza' and 'best_foods' = ['pizza', 'pie', 'cake]:
from django import template from django import template
def in_list(value, arg): def in_list(value, arg):
return value in arg return value in ( arg or [] )
register = template.Library() register = template.Library()
register.filter(in_list) register.filter(in_list)