app/soc/models/base.py
changeset 977 d212d5f4c41a
parent 751 16dffe0b6336
child 1032 ed83d42d1ed7
equal deleted inserted replaced
976:d1a9c7179bbb 977:d212d5f4c41a
    45   because any actual Form code refers to these new names, so they are should
    45   because any actual Form code refers to these new names, so they are should
    46   be familiar to view creators.  
    46   be familiar to view creators.  
    47   """
    47   """
    48 
    48 
    49   _fields_cache = None
    49   _fields_cache = None
    50   
    50 
       
    51   def toDict(self):
       
    52     """Returns a dict with all StringProperty values of this entity
       
    53     """
       
    54 
       
    55     result = {}
       
    56 
       
    57     for key, value in self.properties().iteritems():
       
    58       # Skip everything but StringProperties
       
    59       if not isinstance(value, db.StringProperty):
       
    60         continue
       
    61       result[key] = getattr(self, key)
       
    62 
       
    63     return result
       
    64 
    51   @classmethod
    65   @classmethod
    52   def fields(cls):
    66   def fields(cls):
    53     """Called by the Django template engine during template instantiation.
    67     """Called by the Django template engine during template instantiation.
    54     
    68     
    55     Since the attribute names use the Form fields naming instead of the
    69     Since the attribute names use the Form fields naming instead of the