예제 #1
0
파일: views.py 프로젝트: MEXAHIK/Students
def add_group(request):
	form = GroupForm()
	if request.method == 'POST':
		form = GroupForm(request.POST)
		if form.is_valid():
			form.save()
			return HttpResponseRedirect('/group/')
	return render_to_response('add_group.html', {'form': form}, context_instance = RequestContext(request))
예제 #2
0
파일: views.py 프로젝트: MEXAHIK/Students
def edit_group(request, id):
	group = get_object_or_404(Groups, id = id)
	form = GroupForm(instance = group)
	if request.method == 'POST':
		form = GroupForm(request.POST, instance = group)
		if form.is_valid():
			form.save()
			return HttpResponseRedirect ('/group/')
	return render_to_response('edit_group.html', {'form': form}, context_instance = RequestContext(request))