Snippet List
This snippet shows a way to preserve GET arguments with pagination. Many people make mistakes to omit the query arguments besides page arguments for the pagination, and making sure correct may sphagettize your code.
- template
- get
- view
- pagination
- arguments
A simple trick to let a function be called with exactly ONE argument from a Django template, by passing it via an attribute. Example:
class SearchResult(object):
@template_callable
def highlighted(self, field):
return self._xappy_result.highlight(field)
result = SearchResult()
result.highlighted.title
{{ result.highlighted.title }}
- template
- templates
- method
- call
- arguments
2 snippets posted so far.