社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Django

为什么Django更新对象不会在第一时间触发?

boyenec • 3 年前 • 375 次点击  

这是我的代码:

功能1#此功能工作正常

意见。py公司

def ForgetPassword(request):
    if request.method == "POST":
    .....my others code
   profile_obj = UserProfile.objects.get(user=user_obj)
      
   profile_obj.email_confirmed = False
   profile_obj.save() 
   .....my others code

class ChangePassword_link(View):
        #my others code....

        if user is not None and account_activation_token.check_token(user, token):
            profile_obj = UserProfile.objects.filter(user=user).update(email_confirmed = True)
            messages.success(request, ('Your account have been confirmed. Now you can login'))
            return redirect('members:change-password-page')
                
        else:
            messages.warning(request, ('The confirmation link was invalid, possibly because it has already been used.'))
            return redirect('members:change-password-page') 
        
       #my others code....
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/137721
 
375 次点击