update
[prawokultury.git] / events / admin.py
1 # -*- coding: utf-8 -*-
2 # This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 #
5 from django.conf import settings
6 from django.contrib import admin
7 from fnpdjango.utils.models.translation import translated_fields
8 from events.models import Event
9
10
11 class EventAdmin(admin.ModelAdmin):
12     fieldsets = (
13         (None, {'fields': ('date', 'date_end', 'link')}),
14     ) + tuple(
15         (ln, {'fields': (
16             ('published_%s' % lc),
17             'title_%s' % lc,
18             'organizer_%s' % lc,
19             'place_%s' % lc,
20             )})
21         for lc, ln in settings.LANGUAGES
22     )
23     list_display = translated_fields(
24         ('title', 'place', 'organizer', 'published'), settings.LANGUAGES
25         ) + ('date',)
26     date_hierarchy = 'date'
27     list_filter = translated_fields(('published',))
28
29
30 admin.site.register(Event, EventAdmin)