django 前台-后台传输数据


需要返回的数据写在 在上一个view中最后 return的字典中

 dic = {'class_all': class_all, 'userclass_all': userclass_all, "id": id}

    return render_to_response('buy.html', dic)

或者 

<button class="btn btn-simple div2" rel="tooltip" title="Flip Card" onclick="rotateCard(this)">
            <i class="fa fa-reply"></i> <a href="/buy?buy_info={{ classfy.id }}">购买</a>
                            </button>

 写在 页面的 button 或者跳转的 链接中。

 其中 关于 objects.filter 的使用 当 class_all = Imfromation.objects.filter(id1=id)   id 所代表的不是Imformaton 中的属性,那么会报错。 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM