diff options
author | Weitian LI <liweitianux@gmail.com> | 2014-04-20 19:03:39 +0800 |
---|---|---|
committer | Weitian LI <liweitianux@gmail.com> | 2014-04-20 19:03:39 +0800 |
commit | e0c0722e2f836c6773b8639739a6890dd0f7d52f (patch) | |
tree | 9b7510bf69ec9c7274d98655ccb3cc1bfae432bd | |
parent | 5bd3311371eddda6952ea85b41c6f59d36d7dd3b (diff) | |
download | django-skaschool-e0c0722e2f836c6773b8639739a6890dd0f7d52f.tar.bz2 |
fixed UserProfile model to use CharField choices in "is_approved" and "is_sponsored"
-rw-r--r-- | account/models.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/account/models.py b/account/models.py index 04f255c..22b11af 100644 --- a/account/models.py +++ b/account/models.py @@ -24,13 +24,28 @@ class UserProfile(models.Model): ('F', _("Female")), ('X', _("Secret")), ) + # status choices of is_approved + APPROVED_STATUS = ( + ('Y', _("Yes")), + ('N', _("No")), + ('C', _("Checking")), + ) + # status choices of is_sponsored + SPONSORED_STATUS = ( + ('Y', _("Yes")), + ('N', _("No")), + ('C', _("Checking")), + ) + # model fields user = models.ForeignKey(User, unique=True, verbose_name=_("Username")) realname = models.CharField(_("Name"), max_length=30) gender = models.CharField(_("Gender"), max_length=1, choices=GENDERS) institute = models.CharField(_("Institute"), max_length=100) # store the infomation about approval and sponsorship - is_approved = models.BooleanField(_("Is approved"), default=False) - is_sponsored = models.BooleanField(_("Is sponsored"), default=False) + is_approved = models.CharField(_("Is approved"), max_length=1, + choices=APPROVED_STATUS, default='C') + is_sponsored = models.CharField(_("Is sponsored"), max_length=1, + choices=SPONSORED_STATUS, default='C') class Meta: verbose_name = _('user profile') |