From e0c0722e2f836c6773b8639739a6890dd0f7d52f Mon Sep 17 00:00:00 2001 From: Weitian LI Date: Sun, 20 Apr 2014 19:03:39 +0800 Subject: fixed UserProfile model to use CharField choices in "is_approved" and "is_sponsored" --- account/models.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'account') 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') -- cgit v1.2.2