我收到此错误,我不知道为什么:
Reverse for 'buildings.views.generate' with arguments '()' and keyword arguments '{'new_id': -1}' not found.
这是我的 urls.py 的(一部分):
url(r'^buildings/generate/new_building(?P<new_id>\d+)', 'buildings.views.generate'),
风景:
@login_required
def generate(request, new_id):
session = {}
if new_id == -1:
other_buildings = Building.objects.filter(utente=request.user, pronto=False)
if other_buildings.length > MAX_TEMPORARY_BUILDINGS:
return redirect('buildings.views.index')
else:
building = Building(utente=request.user, pronto=False)
building.save()
return redirect('buildings.views.generate', building_id=building)
elif new_id >=0:
building = Building.objects.filter(pk=new_id)
if building.utente != request.user:
raise Http404
elif building.pronto:
return redirect('buildings.views.detail', building_id=new_id)
elif building.nome == None:
buildings= Building.objects.filter(pronto=True).order_by('utente')
session['buildings'] = buildings
session['building'] = building
else:
raise Http404
return render_to_response('buildings/generate/generate-index.html', session, context_instance = RequestContext(request))
这里是模板“base.html”中产生错误的代码:
<li><a href="{% url buildings.views.generate new_id=-1 %}">New Building</a></li>
我看不到任何错误,请帮助我。