1 # -*- coding: utf-8 -*-
3 Migdal (מִגְדָּל) is a multilingual blog Django app.
5 Author: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
7 from django.conf import settings
8 from fnpdjango.utils.app import AppSettings
9 from django.utils.translation import ugettext_lazy as _
10 from migdal.helpers import EntryType
13 class Settings(AppSettings):
15 # (slug, commentable, on main)
17 EntryType('news', _('news'), commentable=True, on_main=True, promotable=True),
18 EntryType('publications', _('publications')),
19 EntryType('info', _('info')),
20 EntryType('event', _('events')),
24 ('topics', _('topics')),
25 ('types', _('types')),
29 MAIN_PAGE_ENTRY = None
31 def _more_TYPES_DICT(self, value):
32 return dict((t.db, t) for t in self.TYPES)
35 def _more_TYPES_ON_MAIN(self, value):
36 return tuple(t.db for t in self.TYPES if t.on_main)
39 def _more_TYPES_PROMOTABLE(self, value):
40 return tuple(t.db for t in self.TYPES if t.promotable)
41 TYPES_PROMOTABLE = None
43 def _more_OBLIGATORY_LANGUAGES(self, value):
44 return value or tuple(lang for lang in settings.LANGUAGES if lang[0] == settings.LANGUAGE_CODE)
45 OBLIGATORY_LANGUAGES = None
47 def _more_OPTIONAL_LANGUAGES(self, value):
49 return tuple(lang for lang in settings.LANGUAGES if lang not in self.OBLIGATORY_LANGUAGES)
52 OPTIONAL_LANGUAGES = None
54 def _more_LANGUAGES(self, value):
55 return self.OBLIGATORY_LANGUAGES + self.OPTIONAL_LANGUAGES
58 PUBLISH_DATE_EDITABLE = False
60 app_settings = Settings('MIGDAL')