直接贴代码理解吧
view.py
def edit_blog(request,now_id): # 编辑已创建的blog blog = BlogPost.objects.get(pk=now_id) if request.method != 'POST': form = blogform(instance=blog) else: form = blogform(instance=blog,data=request.POST)
直接贴代码理解吧
view.py
def edit_blog(request,now_id): # 编辑已创建的blog blog = BlogPost.objects.get(pk=now_id) if request.method != 'POST': form = blogform(instance=blog) else: form = blogform(instance=blog,data=request.POST)