Okay, but still the problem is that how do I set the value of status field, as I have written in the code, verification.status = 'Verified' it is not giving any error but it is not working either
On Wed, Nov 2, 2022, 9:51 PM kateregga julius <[email protected]> wrote: > Don't use square blackest [ ] > > status_choices=(('Unverified','Unverified'),('Verified','Verified')) > > On Wed, Nov 2, 2022, 5:52 PM Aaryan R Soni <[email protected]> > wrote: > >> 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 [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/6ee9dae8-2879-4c3d-a921-238b36fcb975n%40googlegroups.com >> <https://groups.google.com/d/msgid/django-users/6ee9dae8-2879-4c3d-a921-238b36fcb975n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAMVv_-E9uO8A7tJH04mHpkS-LeCwdJVKnMXtppZKkqp6JM2K5Q%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAMVv_-E9uO8A7tJH04mHpkS-LeCwdJVKnMXtppZKkqp6JM2K5Q%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- *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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK5JjLSs9yNckAOEw0ygcXMFTkZRTZmZwAp_tPVA2n81kPzY6Q%40mail.gmail.com.

