[Mpuls-commits] r2040 - wasko/branches/2.0/mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Mar 19 15:31:08 CET 2010


Author: torsten
Date: 2010-03-19 15:31:07 +0100 (Fri, 19 Mar 2010)
New Revision: 2040

Modified:
   wasko/branches/2.0/mpulsweb/model/case.py
Log:
* mpulsweb/model/case.py (Field): Added three new option to configure
  if and how a field will be displayed in the overview page, 
  (MpulsCase.get_overview_fields): Added new function to return a list
  of fields which will be shown in overview.


Modified: wasko/branches/2.0/mpulsweb/model/case.py
===================================================================
--- wasko/branches/2.0/mpulsweb/model/case.py	2010-03-19 14:28:04 UTC (rev 2039)
+++ wasko/branches/2.0/mpulsweb/model/case.py	2010-03-19 14:31:07 UTC (rev 2040)
@@ -149,6 +149,15 @@
        digest -- If true (default false), the field will be listed in
                the default case digest.
 
+       overview -- If true (default false), the field will be listed in the
+               default caseoverview
+
+       overview_label -- Defines a label to be used in the overviewpage.
+               Default will be the name of the field. 
+
+       overview_style -- Defines a css style for the fields in the overview
+               (default table_name) 
+
        search_retrieve -- If true (default false), the field will be
                returned from a search.  This only works if the name is a
                column of the master table.
@@ -186,7 +195,10 @@
     def __init__(self, name, digest=False,
                  search_retrieve=False, search_match=False,
                  session=False, preload=False,
-                 alias=None, alias_force_string=True):
+                 alias=None, alias_force_string=True,
+                 overview=False, overview_label=None,
+                 overview_style="table_name"):
+
         self.name = name
         self.digest = digest
         self.search_retrieve = search_retrieve
@@ -197,6 +209,10 @@
         self.alias = alias
         self.alias_force_string = alias_force_string
 
+        self.overview = overview
+        self.overview_label = overview_label or name 
+        self.overview_style = overview_style
+
     @property
     def default(self):
         """Return the default value when accessed via the alias name"""
@@ -429,6 +445,11 @@
         return [field.name for field in cls.fields if field.preload]
 
     @classmethod
+    def get_overview_fields(cls):
+        """Return a list fields to be displayed in overviewpage."""
+        return [field for field in cls.fields if field.overview]
+
+    @classmethod
     def get_session_fields(cls):
         """Return a list describing the fields to store in the session case.
         The items of the list are those items of cls.alias whose



More information about the Mpuls-commits mailing list