I am writing a Player model class in Python with Django, and I've ran into a small problem with the password member. I'd like the password to be automatically hashed upon assignment, but I can't find anything about overloading the assignment operator or anything. Is there any way I can overload the assignment of password
so as to automatically do hashlib.md5(password).hexdigest()
on it?
from django.db import models
class Player(models.Model):
name = models.CharField(max_length=30,unique=True)
password = models.CharField(max_length=32)
email = models.EmailField()