我正在尝试将从表单中收集的数据传递到另一个页面上。我是Django的初学者,仍然不理解POST-and-GET。在
过去几天我一直在努力解决这个问题,但我一直在绕圈子。我想这是一个相当简单的问题,但我不知道发生了什么。在
我希望在我的selectinterest视图中,一旦单击submit,就会将所选兴趣发送到另一个名为selectdiscipline的视图。我希望能够在我的select_discipline视图中使用所选兴趣。在
在视图.py在
@login_required
def select_interest(request):
context = RequestContext(request)
interests = Interest.objects.order_by('name')
return render_to_response('selectinterest.html', {'interests': interests, 'disciplines': disciplines }, context )
@login_required
def select_discipline(request):
interest = request.POST.get('interest-select')
context = RequestContext(request)
interests = Interest.objects.order_by('name')
disciplines = Discipline.objects.filter(parentInterest = interest)
return render('selectdiscipline.html', {'interest': interest, 'interests': interests, 'disciplines': disciplines }, context )
在选择Interest.html在
^{pr2}$
在选择Interest.html在
在视图.py在
^{pr2}$相关问题 更多 >
编程相关推荐