为什么Django中的实例无法与我配合?

时间:2019-02-03 18:54:51

标签: python django

我尝试过使用此函数返回字段,但是它不返回任何内容:)

我该如何解决?

代码

def edtiNote(request , slug):
  if slug:
    n = get_object_or_404(addNote , slugUrl=slug)
  if request.method == 'POST':
     form = addNoteForm(request.POST or None , instance=n)
     if form.is_valid():
       new_edit_form = form.save(commit=False)
       new_edit_form.user = request.user
       new_edit_form.save()
       return redirect('../../../notes/'+str(new_edit_form.slugUrl))

 elif request.method == 'GET':
     return redirect('../../../notes/'+str(form.slugUrl))

 else:
    form = addNoteForm()

 context = {'formViews':form}

 return render(request , 'edit_Note.html' , context)

0 个答案:

没有答案