0001-misc-fix-count-filter-for-None-values-53924.patch
tests/test_formdata.py | ||
---|---|---|
2565 | 2565 |
tmpl = Template('{{ form_var_value|count }}') |
2566 | 2566 |
assert tmpl.render(context) == '4' |
2567 | 2567 | |
2568 |
tmpl = Template('{{ form_var_value|count }}') |
|
2569 |
assert tmpl.render({}) == '0' |
|
2570 |
assert tmpl.render({'form_var_value': None}) == '0' |
|
2571 | ||
2568 | 2572 | |
2569 | 2573 |
def test_rounding_and_abs_conditions_django(pub, variable_test_data): |
2570 | 2574 |
for true_condition_value in ( |
wcs/qommon/templatetags/qommon.py | ||
---|---|---|
687 | 687 |
def count(queryset): |
688 | 688 |
if hasattr(queryset, 'get_value'): |
689 | 689 |
queryset = queryset.get_value() # unlazy |
690 |
if queryset is None: |
|
691 |
return 0 |
|
690 | 692 |
return len(queryset) |
691 | 693 | |
692 | 694 | |
693 |
- |