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.
5 from django.conf import settings
6 from django.utils.translation import ugettext_lazy as _
7 from migdal.helpers import EntryType
10 def app_setting(global_name, default):
12 return getattr(settings, global_name)
13 except AttributeError:
17 # (slug, commentable, on main)
18 TYPES = app_setting('MIGDAL_TYPES', (
19 EntryType('news', _('news'), commentable=True, on_main=True),
20 EntryType('publications', _('publications'), commentable=False, on_main=False),
21 EntryType('info', _('info'), commentable=False, on_main=False),
23 TYPES_DICT = dict((t.db, t) for t in TYPES)
24 TYPES_ON_MAIN = tuple(t.db for t in TYPES if t.on_main)
28 LANGUAGES = app_setting('MIGDAL_LANGUAGES', settings.LANGUAGES)
29 LANGUAGE_CODE = app_setting('MIGDAL_LANGUAGE_CODE', settings.LANGUAGE_CODE)
30 OBLIGATORY_LANGUAGES = app_setting('MIGDAL_OBLIGATORY', tuple(
31 lang for lang in LANGUAGES if lang[0]==LANGUAGE_CODE))
32 OPTIONAL_LANGUAGES = tuple(lang for lang in LANGUAGES if lang not in OBLIGATORY_LANGUAGES)
36 ('topics', _('topics')),
37 ('types', _('types')),