Пример #1
0
def group_add(request):
    if request.method == 'POST':
        form = TeamForm(request.POST)
        if form.is_valid():
            form.save()
            return render_to_response('common/success.html')
    else:
        form = TeamForm()

    variables = RequestContext(request, {'form': form})
    return render_to_response('crud/group/group_add.html', variables)
Пример #2
0
def group_edit(request, id):
    team = Team.objects.get(pk=id)
    if request.method == "POST":
        form = TeamForm(request.POST, instance=team)
        if form.is_valid():
            form.save()
            return render_to_response('common/success.html')
    else:
        form = TeamForm(instance=team)

    variables = RequestContext(request, {'form': form})

    return render_to_response("crud/group/group_edit.html", variables)