Test coverage report: multilingual_events.templatetags.multilingual_events_tags

# multilingual_events.templatetags.multilingual_events_tags: 12 total statements, 88.9% covered

Generated: Thu 2013-02-28 16:32 SGT

Source file: /Users/martin/Repos/django-multilingual-events/multilingual_events/templatetags/multilingual_events_tags.py

Stats: 8 executed, 1 missed, 3 excluded, 19 ignored

1. `"""Templatetags for the ``simple_events`` app."""`
2. `from django import template`
3. ``
4. `from simple_translation.middleware import filter_queryset_language`
5. ``
6. `from ..models import EventCategory, EventTitle`
7. ``
8. ``
9. `register = template.Library()`
10. ``
11. ``
12. `@register.assignment_tag`
13. `def get_event_categories():`
14. `"""Returns all categories in the database."""`
15. `return EventCategory.objects.all().order_by('position')`
16. ``
17. ``
18. `@register.assignment_tag(takes_context=True)`
19. `def get_events(context, amount=5):`
20. `"""`
21. `Returns upcoming events.`
22. ``
23. `:param request: The current request.`
24. `:param amount: The number of events that should be returned.`
25. ``
26. `"""`
27. `request = context.get('request')`
28. `qs = EventTitle.objects.filter(`
29. `event__is_published=True).order_by('event__start_date')`
30. `qs = filter_queryset_language(request, qs)`
31. `return qs[:amount]`