장고는 잘못된 URL 패턴을 시도하지만 내 실수는 찾을 수 없습니다.왜 장고는 잘못된 URL 패턴을 시도합니까?
urls.py
url(r'^message/(?P<advertisementid>(\d+))/$', chat_view, name="chat_view_with_toid"),
url(r'^profile/(?P<userid>(\d+))/$', profile_view, name="profile"),
url(r'^details/(?P<advertisementid>(\d+))/$', details_view, name='details'),
views.py
def details_view(request, advertisementid):
advertisement_data = Advertisement.objects.get(id=advertisementid)
return render(request, "details.html", {"advertisement_data": advertisement_data})
def profile_view(request, userid):
advertisements = Advertisement.objects.filter(user__id=userid)
return render(request, "profile.html", { 'advertisements': advertisements })
<a href="{% url 'profile' userid=advertisement_data.user.id %}" style="text-decoration:none;">
<input type="submit" class="details-btn-profile" value="Profile"></a>
<a href="{% url 'chat_view_with_toid' advertisementid=advertisement_data.id %}"
style="text-decoration:none">
<input type="submit" class="details-btn-contact" value="Kontakt"></a>
(나는 프로파일 사용자에게 해결하고자하는 곳에서) details.html,210
main.html
<a href="{% url 'details' advertisementid=advertisement.id %}">
<img src="{% static advertisement.image.url %}" alt="Image"/></a>
내가 버튼을 class="details-btn-profile"
클릭 장고 나에게이 오류 줄 때 :
Reverse for 'details' with no arguments not found. 1 pattern(s) tried: ['details/(?P(\d+))/$']
가 왜 세부 사항을 해결 않습니다를? 어떤 아이디어?
주어진 HTML 코드 주변에 서식이 있습니까? –
아니요
Coder949
양식은 내부에있는 제출 버튼의 동작을 제어합니다. 나는 형식이 없다면 어떻게 될지 잘 모르겠습니다. 동일한 URL과 주어진 오류에 대한 GET으로 인한 암시 적 디폴트 값이있을 수 있습니다. –