擅长:python、mysql、java
<p>检查<code>args=(p.id)</code>内部的<code>reverse()</code>,它必须是<code>args=(p.id,)</code>。第一种形式被视为整数而不是序列。</p>
<p>参考文献<a href="http://docs.python.org/reference/datamodel.html#the-standard-type-hierarchy" rel="noreferrer">the doc</a>和<a href="http://docs.python.org/tutorial/datastructures.html#tuples-and-sequences" rel="noreferrer">the tutorial</a>:</p>
<blockquote>
<p>A special problem is the construction of tuples containing 0 or 1
items: the syntax has some extra quirks to accommodate these. Empty
tuples are constructed by an empty pair of parentheses; a tuple with
one item is constructed by following a value with a comma (it is not
sufficient to enclose a single value in parentheses).</p>
</blockquote>
<p>另外,使用<code>'reserve.views.view_reviews'</code>而不仅仅是<code>'view_reviews'</code>,因此:</p>
<pre><code>reverse('reserve.views.view_reviews', args=(p.id,))
</code></pre>
<p>检查<a href="https://docs.djangoproject.com/en/dev/topics/http/urls/#django.core.urlresolvers.reverse" rel="noreferrer">the doc of reverse</a></p>