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