Substitute hyphens with spaces to enale URLs to reference to multi-word tags

1
2
3
4
5
6
def list_tag(request, tag):
    from re import sub
    tag = sub('-',' ',tag)
    query_tag = Tag.objects.get(name=tag)
    events = TaggedItem.objects.get_by_model(Event, query_tag)
    events = events.order_by('-start')

More like this

  1. Frequently used tags/filters for Jinja2 by mathwizard 4 years, 8 months ago
  2. Soft hyphenation (­) template filter using PyHyphen by dokterbob 4 years, 1 month ago
  3. View to retrieve objects meeting a complex tag query by nathangeffen 2 years, 5 months ago
  4. default url routing and shortcut by vicalloy 3 years, 11 months ago
  5. nbsp filter by vitamon 6 months, 2 weeks ago

Comments

(Forgotten your password?)