diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-01-20 20:09:06 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-01-20 20:09:06 +0100 |
commit | d26217d09080ef93fe0b36c3543a266d7a04c688 (patch) | |
tree | 99faaf3ec3a2d6da7d265995419dc6af45a69fbe /ishtar_common/models.py | |
parent | 4abb5ff78620c096ab4238535c8e4b22291a2cb1 (diff) | |
parent | ac595e9aa13d27fb15e70eb1f6e2d11f928a4c4a (diff) | |
download | Ishtar-d26217d09080ef93fe0b36c3543a266d7a04c688.tar.bz2 Ishtar-d26217d09080ef93fe0b36c3543a266d7a04c688.zip |
Merge branch 'v0.9' into wheezy
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r-- | ishtar_common/models.py | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 7451d9b33..d58d549c8 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -60,7 +60,7 @@ from simple_history.models import HistoricalRecords as BaseHistoricalRecords from ishtar_common.ooo_replace import ooo_replace from ishtar_common.model_merging import merge_model_objects -from ishtar_common.utils import get_cache +from ishtar_common.utils import get_cache, disable_for_loaddata from ishtar_common.data_importer import Importer, ImportFormater, \ IntegerFormater, FloatFormater, UnicodeFormater, DateFormater, \ TypeFormater, YearFormater, StrToBoolean, FileFormater @@ -308,6 +308,7 @@ class Cached(object): return None +@disable_for_loaddata def post_save_cache(sender, **kwargs): sender.refresh_cache() @@ -1034,15 +1035,33 @@ class IshtarSiteProfile(models.Model, Cached): label = models.TextField(_(u"Name")) slug = models.SlugField(_(u"Slug"), unique=True) description = models.TextField(_(u"Description"), null=True, blank=True) + base_color = models.CharField( + _(u"CSS color code for base module"), + default='rgba(0, 0, 0, 0)', max_length=200) files = models.BooleanField(_(u"Files module"), default=False) + files_color = models.CharField( + _(u"CSS color code for files module"), + default='rgba(0, 32, 210, 0.1)', max_length=200) context_record = models.BooleanField(_(u"Context records module"), default=False) + context_record_color = models.CharField( + _(u"CSS color code for context record module"), + default='rgba(210,200,0,0.2)', max_length=200) find = models.BooleanField(_(u"Finds module"), default=False, help_text=_(u"Need context records module")) + find_color = models.CharField( + _(u"CSS color code for find module"), + default='rgba(210,0,0,0.15)', max_length=200) warehouse = models.BooleanField( _(u"Warehouses module"), default=False, help_text=_(u"Need finds module")) + warehouse_color = models.CharField( + _(u"CSS code for warehouse module"), default='rgba(10,20,200,0.15)', + max_length=200) mapping = models.BooleanField(_(u"Mapping module"), default=False) + mapping_color = models.CharField( + _(u"CSS code for mapping module"), default='rgba(72, 236, 0, 0.15)', + max_length=200) homepage = models.TextField( _(u"Home page"), null=True, blank=True, help_text=_(u"Homepage of Ishtar - if not defined a default homepage " @@ -1103,6 +1122,19 @@ class IshtarSiteProfile(models.Model, Cached): def __unicode__(self): return unicode(self.label) + def get_raw_css(self): + css = '' + for attr, css_name in (('base_color', 'operation'), + ('files_color', 'file'), + ('context_record_color', 'context-record'), + ('find_color', 'find'), + ('warehouse_color', 'warehouse')): + css += ''' +.menu-%s{ + background-color: %s; +}''' % (css_name, getattr(self, attr)) + return css + def save(self, *args, **kwargs): raw = False if 'raw' in kwargs: @@ -2413,7 +2445,7 @@ class Person(Address, Merge, OwnPerms, ValueGetter): ('Dr', _(u'Doctor')), ) TABLE_COLS = ('name', 'surname', 'raw_name', 'email', 'person_types_list', - 'attached_to', 'town') + 'attached_to__name', 'town') SHOW_URL = 'show-person' MODIFY_URL = 'person_modify' @@ -2426,6 +2458,9 @@ class Person(Address, Merge, OwnPerms, ValueGetter): 'person_types': 'person_types__pk__in', 'ishtaruser__isnull': 'ishtaruser__isnull' } + COL_LABELS = { + 'attached_to__name': _(u"Organization") + } # fields old_title = models.CharField(_(u"Title"), max_length=100, choices=TYPE, |