Forked from igniteflow/Custom getter and setter for Django model fields
Last active
August 29, 2015 14:06
-
-
Save victorono/86c162066533e2223c04 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
class Person(models.Model): | |
_first_name = models.CharField(max_length=30, db_column='first_name') | |
last_name = models.CharField(max_length=30) | |
@property | |
def first_name(self): | |
"""your logic here, return value""" | |
return "foo" | |
@first_name.setter | |
def first_name(self, value): | |
self._first_name = value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment