小编Lea*_*imh的帖子

Django如何在视图中使用完整方法后实现alert()(弹出消息)

我想在view.py中的方法完成后有一个alert()消息(如javascript中的消息)

我的方法是

def change_password(request):
    dictData = getInitialVariable(request)

    in_username = request.POST['txt_username']
    in_password = request.POST['txt_password']
    in_new_password = request.POST['txt_new_password']


    user = authenticate(username=in_username, password=in_password)
    if user is not None:
        if user.is_active:
            u = User.objects.get(username=in_username)
            u.set_password(in_new_password)
            u.save()

            # Redirect to a success page.
            return HttpResponseRedirect('/profiles/'+in_username)
Run Code Online (Sandbox Code Playgroud)

将u保存到数据库后,将显示弹出消息。我该如何实施?

django alert message popup

8
推荐指数
3
解决办法
4万
查看次数

标签 统计

alert ×1

django ×1

message ×1

popup ×1