Beispiel #1
0
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))
Beispiel #2
0
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))