Ejemplo n.º 1
0
def group_add(request):
    """
    Добавление группы
    """
    result = ''
    if request.method == "POST":
        form = GroupForm(request.POST)
        if form.is_valid():
            if form.save():
                result = 'success'

    else:
        form = GroupForm()
        title = 'Добавление группы'

    return render_to_response('base/form.html', locals(), context_instance=RequestContext(request))
Ejemplo n.º 2
0
def group_edit(request, id):
    """
    Редактирование группы
    """
    result = ''
    group = get_object_or_404(Group, pk=id)
    if request.method == "POST":
        form = GroupForm(request.POST, instance=group)
        if form.is_valid():
            if form.save():
                result = 'success'

    else:
        form = GroupForm(instance=group)
        title = 'Редактирование группы'

    return render_to_response('base/form.html', locals(), context_instance=RequestContext(request))
Ejemplo n.º 3
0
def group_add(request):
    """
    Добавление группы
    """
    result = ''
    if request.method == "POST":
        form = GroupForm(request.POST)
        if form.is_valid():
            if form.save():
                result = 'success'

    else:
        form = GroupForm()
        title = 'Добавление группы'

    return render_to_response('base/form.html',
                              locals(),
                              context_instance=RequestContext(request))
Ejemplo n.º 4
0
def group_edit(request, id):
    """
    Редактирование группы
    """
    result = ''
    group = get_object_or_404(Group, pk=id)
    if request.method == "POST":
        form = GroupForm(request.POST, instance=group)
        if form.is_valid():
            if form.save():
                result = 'success'

    else:
        form = GroupForm(instance=group)
        title = 'Редактирование группы'

    return render_to_response('base/form.html',
                              locals(),
                              context_instance=RequestContext(request))