Archive search - #159
Conversation
- using render_kw
- using .archive class more generally
- Does not conflict with endpoints existing
- entended_date_converter returns datetime.date in path.py
- items will be grouped up later.
# Conflicts: # onegov/election_day/formats/election/wabstic_proporz.py # onegov/election_day/tests/formats/election/test_wabstic_proporz.py
|
If this is about snippets like this, you need another approach: <strong tal:condition="archive_items" i18n:translate="">
Found ${item_count} items.
</strong>To use variables in Chameleon templates, you need do something like this: <strong tal:condition="archive_items" i18n:translate>
Found <tal:b i18n:name="item_count>${item_count}</tal:b> items.
</strong>
See https://chameleon.readthedocs.io/en/latest/reference.html#i18n-name This is basically the same as providing the Do you want to fix this before I do my review? |
href
left a comment
There was a problem hiding this comment.
Looks good to me. There are some small issues, but nothing serious. Good job!
| to_date=None, | ||
| types=None, | ||
| item_type=None, | ||
| domain=None, |
There was a problem hiding this comment.
Since domain and answer are lists (i.e. contain a plural of elements), I'd name them domains and answers.
| ] | ||
|
|
||
| items = dict( | ||
| votes=[v for v in items if v.type == 'vote'], |
There was a problem hiding this comment.
If you don't intend to add any items to votes or elections, I would not use a list, instead use a tuple:
votes = tuple(v for v in items if v.type == 'vote')
Note that this is not the same as writing
votes = (v for v in items if v.type == 'vote')
Which would result in a generator, which is not what you want here. By using a tuple you use less memory and you communicate your intent of this list not changing later.
Adds the archive search page with tabs and pagination.
One issue I could not resolve were translations strings with variables:
${x} items foundSearch in ${x}I also added other translation strings like
From datethat are not ignored.Is it reproducible?