Django将信息存储在一个变量中

时间:2014-03-02 09:10:58

标签: python django session

我有不同的商品页面,每个商品都有自己的价格,我想存储在一个变量中,然后将所有商品发送到PayPal付款表单。 所以问题是,如何从不同页面存储有关价格的信息?我尝试过会议但没有任何反应。

        <article>
 {% block content %}
        <span>Kuriame mieste registruojiesi</span>
        <select>
            {% for item in upsell.skaidyti_miestus %}
                <option value="{{item}}">{{ item }}</option>
            {% endfor %}
        </select>
     {%if upsell.prideti_upsell_nr_2_taip%} 
        <button onclick="location.href='/upselliai/{{upsell.upsell_nr2_taip.id}}/pirkti/'">Taip, pridÄ—ti prie bendros sumos</button>
     <!-- {#prideti kaina paimti ID} -->
        {% else %}
     <button onclick="location.href='/pirkejas/apmoketi'">Taip, pridÄ—ti prie bendros sumos</button>
     {%endif%}
     {%if upsell.prideti_upsell_nr_2_ne%}   
        <a href="/upselliai/{{upsell.upsell_nr2_ne.id}}/pirkti/">{{ upsell.atsisakymo_tekstas }}</a>
        <!-- {#prideti kaina paimti ID} -->
     {% else %}
     <a href="/pirkejas/apmoketi">{{ upsell.atsisakymo_tekstas }}</a>
     {%endif%}
{% endblock %}
    </article>

my views.py

def pirkti_upsell(request, upsellis_id = 1):

#if 'pirkejas_id' in request.session:
session_pirkejas_id = request.session['pirkejas_id']
Upsellis.objects.get(id = upsellis_id).sum(session_pirkejas_id)

return render_to_response("upsell_template.html", {"upsell": Upsellis.objects.get(id = upsellis_id)})

0 个答案:

没有答案