我有一个显示到订阅页面的订阅表单视图,我也想在主页中显示相同的表单,我尝试使用{% include 'accounts/subscribe.html' %}并{% extends 'accounts/subscribe.html' %}在主页中也尝试过(来自类似问题的建议,但不相同)。我该如何解决这个问题?
指向 subscribe.html 的视图
def subscribe(request):
if request.method == 'POST':
subscribe_form = EmailListForm(request.POST)
if subscribe_form.is_valid():
subscribe_form = subscribe_form.save()
return render(request, 'accounts/subscribe_done.html', {'name': subscribe_form.name})
else:
subscribe_form = EmailListForm()
return render(request, 'accounts/subscribe.html', {'sub_form': subscribe_form})
饮歌长啸
慕容森
摇曳的蔷薇
相关分类