Serialize the @property methods in a Python class.
        Posted  
        
            by ashchristopher
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by ashchristopher
        
        
        
        Published on 2010-04-06T17:57:45Z
        Indexed on 
            2010/04/06
            19:23 UTC
        
        
        Read the original article
        Hit count: 208
        
Is there a way to have any @property definitions passed through to a json serializer when serializing a Django model class?
example:
class FooBar(object.Model)
name = models.CharField(...)
@property
def foo(self):
    return "My name is %s" %self.name
Want to serialize to:
[{
'name' : 'Test User',
'foo' : 'My name is Test User',
},]
© Stack Overflow or respective owner