Hey guys, i am facing some issues using choices in models.CharField. I am 
creating a model which has username and status, where status is my choice 
field. it has 2 values, 'Unverified' and 'Verified'.

class user_stutus(models.Model):
    status_choices=[('Unverified','Unverified'),('Verified','Verified')]
    uname=models.OneToOneField(User,on_delete=models.CASCADE)
    status=models.CharField(max_length=11,choices=status_choices,default=
'Unverified')

def verifyCode(request):
    global errors,session
    if request.method == 'POST':
        code = request.POST['code']
        user=User.objects.get(email=session['email'])
        print('user',user)
        print('request',session['email'])
        if session['code'] != code:
            errors['code'] = 'Verification code did not match!'
            return redirect('/user/user-verify/')
        verification = user_stutus.objects.get(username=user)
        
*verification.status = 'Verified'    #here i am changing its value and 
facing the issue.*
        return redirect('/user/user-login/')

can someone give me any solution for this?
Thank you!

-- 


 

*DISCLAIMER*

Any
 views or opinions presented in this email are 
solely those of the 
author and do not necessarily represent those of the 
Ganpat University.

 

-- 


 

*DISCLAIMER*

Any
 views or opinions presented in this email are 
solely those of the 
author and do not necessarily represent those of the 
Ganpat University.

 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6ee9dae8-2879-4c3d-a921-238b36fcb975n%40googlegroups.com.

Reply via email to