Skip to content

Instantly share code, notes, and snippets.

@alexlopes
Created October 16, 2017 13:11
Show Gist options
  • Save alexlopes/b21bf21a7c1717a6c7034aa7ad063990 to your computer and use it in GitHub Desktop.
Save alexlopes/b21bf21a7c1717a6c7034aa7ad063990 to your computer and use it in GitHub Desktop.
Python Trickts

Transiente property for Django Model

class MyModel(models.Model):

created = models.DateTimeField(auto_now_add=True)

...

def _get_children_properties(self):
    return self._children_properties

def _set_children_properties(self, value):
    print '_set_children_properties'
    self._children_properties = value

children_properties = property(_get_children_properties, _set_children_properties)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment