このエラーが発生しましたが、理由がわかりません。
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>
エラーが表示されません。助けてください。