common_settings.py 2.33 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
# -*- coding: utf-8 -*-
""" Common settings

"""
import locale
import plugin_dbui as dbui

from datetime import datetime
from callbacks import INHIBIT_CASCADE_DELETE
from gluon.tools import PluginManager
from my_validators import IS_IN_USET

#-------------------------------------------------------------------------------
#
# PLUGIN DBUI
#
#-------------------------------------------------------------------------------
plugins = PluginManager()
plugins.dbui.app_css = 'static/my.css'
20
plugins.dbui.app_debug = 'static/src'
21
plugins.dbui.app_libmin = 'static/track_events-min.js'
22
plugins.dbui.app_lg = 'static/locale/myapp-lang-fr.js'
23 24
plugins.dbui.app_script = 'static/app.js'
# plugins.dbui.app_script_dir = None
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59

#-------------------------------------------------------------------------------
#
# LANGUAGE
#
#-------------------------------------------------------------------------------
T.set_current_languages('en', 'en-gb', 'en-us')     # mother tongue
T.force('fr-fr')                                    # user language
T.lazy = False                                      # immediate translation

locale.setlocale(locale.LC_ALL, "fr_FR.UTF-8")

#-------------------------------------------------------------------------------
#
# CONSTANTS
#
#-------------------------------------------------------------------------------
FORMATS = ['csv', 'html', 'pdf', 'tex']

now = datetime.now()
today = now.strftime("%Y-%m-%d")
undef = T(dbui.UNDEF)
undef_id = dbui.UNDEF_ID
year = now.year

#-------------------------------------------------------------------------------
#
# COMMON CONFIGURATION FOR FORMS AND GRIDS
#
#-------------------------------------------------------------------------------
tables = ['auth_group',
          'auth_membership',
          'auth_user',
          'events',
          'fundings',
60
          'graphs',
61
          'history',
62
          'lists',
63
          'metrics1d',
64
          'metrics2d',
65 66
          'object_categories',
          'objects',
67 68 69
          'people',
          'people_categories',
          'projects',
70
          'teams']
71 72 73 74 75 76 77

dbui.configure_forms(tables, plugins=['pFormToolTip'], width=350)

dbui.configure_grids(tables, plugins=['pGridRowEditorConfirmDelete',
                                      'pGridRowEditorContextMenu',
                                      'pGridRowEditorDblClick',
                                      'pGridToolbar'])