2017-02-22 72 views
0

我試圖在django中將一些變量傳遞給我的視圖。所需的信息是用戶是否想要下個月或上個月以及當前月份。這是我到目前爲止...將多個變量從模板傳遞到視圖

<a href="{% url 'tande:holiday' %}?value=previous" class='previous' id='previous' name='previous'><<-Previous</a>&nbsp;&nbsp;<a href="{% url 'tande:holiday' %}?value=next" name = 'next' class='next' id='next'>Next->></a> 

我已經得到了下一個和以前的工作 - 沒有問題!但是我無法得到年份和月份的信息。視圖:

​​
  • 我可以通過多個變量在我的網址是什麼?即<a href="{% url 'tande:holiday' %}?value=previous?year={{ year }}?month={{ month }}" ...

感謝

回答

1

您需要使用&分離GET參數。

<a href="{% url 'tande:holiday' %}?value=previous&year={{ year }}&month={{ month }}" 

我不明白你的第二個問題。

+0

謝謝!我不認爲我知道我在問什麼,或者我已經編輯了它。 –

相關問題