url conf error ----找不到edit.html

时间:2017-08-08 11:14:24

标签: django-views

我一直在做一个项目,但我无法向edit.html和details.html发布请求。

这是我的代码:

dog_app / urls.py

from django.conf.urls import url
from . import views

urlpatterns = [
    url(r'^$',views.index),
    url(r'^create$',views.create),
    url(r'^edit/(?P<id>\d+)$', views.edit),
    url(r'^(?P<id>\d+)/details/$', views.details),
]

views.py

from django.shortcuts import render,redirect
from models import Dog

def edit(request, id):
     dog=Dog.objects.get(id=id)
     context={'dog': dog}
     return render(request,'dog_app/edit.html',context)


def details(request, id):
     dog=Dog.objects.get(pk=id)
     context={"dog": dog}
     return render(request,'dog_app/details.html',context)

错误: Page not found

0 个答案:

没有答案