-
-
Save joestump/9b76fd94378c960ed7c3 to your computer and use it in GitHub Desktop.
EmailField bug in Django
This file contains 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
class AlternateEmail(models.Model): | |
email = models.EmailField(unique=True) | |
user = models.ForeignKey(User, related_name="alternate_emails") | |
def __unicode__(self): | |
return self.email | |
""" | |
>>> from myapp.models import AlternateEmail | |
>>> from django.contrib.auth.models import User | |
>>> email = AlternateEmail() | |
>>> email.user = User.objects.get(pk=1) | |
>>> email.email = {'verified': True, 'email': 'joe@example.com'} | |
>>> email.save() | |
>>> print str(email.email) | |
{'verified': True, 'email': 'joe@asdf.com'} | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment