我认为我没有看到任何说你不允许这样做(或者你是)的东西,但是你有什么理由不应该这样做吗?它似乎工作正常。
def get_page(request, topic_slug = 'home', tag_slug = None, form = None):
#...
if form is None:
form = CommentForm()
d = {'topic':topic, 'topics':topics, 'tags':tags, 'comments':comments, 'form':form}
d.update(csrf(request))
return render_to_response('page.html', d)
def save_comment(request, topic_slug):
if request.method == 'POST':
form = CommentForm(request.POST)
if form.is_valid():
#...save
else:
kwargs = {'topic_slug':topic_slug}
kwargs['form'] =form
return get_page(request, **kwargs) #<-------------- this
return HttpResponseRedirect(reverse('get_page', kwargs = {'topic_slug':topic_slug}))