f68b0059695142bb591a8c234e0f11f6e68dd961
[prawokultury.git] / prawokultury / menu_items.py
1 # -*- coding: utf-8
2 from migdal.models import Category, Entry
3 from menu.helpers import ObjectMenuItem, MenuItem, ModelMenuItem
4 from django.core.urlresolvers import reverse_lazy
5 from django.utils.translation import ugettext_lazy as _
6
7
8 ITEMS = []
9
10 def add_entry(**qs):
11     try:
12         entry = Entry.objects.get(**qs)
13     except Entry.DoesNotExist:
14         return
15     if not entry.published:
16         return
17     ITEMS.append(ObjectMenuItem(entry))
18
19 add_entry(slug_pl='o-nas')
20
21 ITEMS.append(ModelMenuItem(Entry, reverse_lazy('migdal_entry_list_publications'),
22         field_lookups={'type': 'publications'}, title=_('Publications')))
23
24 ITEMS.append(MenuItem(reverse_lazy('events'), _('Events'),
25         more_urls=(reverse_lazy('events_past'),)))
26
27 ITEMS.append(ObjectMenuItem(Category.objects.get(slug_pl='stanowisko'),
28     rev_lookups={Entry: 'categories'}, title=_('Positions')))
29 #CategoryMenuItem(Category.objects.get(slug_pl='stanowisko'),
30 #            title=_('Positions')),
31
32 ITEMS.append(ObjectMenuItem(Entry.objects.get(slug_pl='pierwsza-pomoc'),
33     title=_('First aid in copyright')))
34