我尝试过使用此函数返回字段,但是它不返回任何内容:)
我该如何解决?
代码
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)