class B64Field models TextField def to_python self value return base64

1
2
3
4
5
6
7
class B64Field(models.TextField):
def to_python(self, value):
return base64.b64decode(value)
def get_db_prep_value(self, value):
return base64.b64encode(value)