Ejemplo n.º 1
0
def student_add(request):
    """
    ДОбавление студента
    """
    result = ''
    if request.method == "POST":
        form = StudentForm(request.POST)
        if form.is_valid():
            if form.save():
                result = 'success'

    else:
        form = StudentForm()
        title = 'Добавление студента'

    return render_to_response('base/form.html', locals(), context_instance=RequestContext(request))
Ejemplo n.º 2
0
def student_edit(request, id):
    """
    Редактирование студента
    """
    result = ''
    student = get_object_or_404(Student, pk=id)
    title = 'Редактирвоание студента %s' % student
    if request.method == "POST":
        form = StudentForm(request.POST, instance=student)
        if form.is_valid():
            if form.save():
                result = 'success'

    else:
        form = StudentForm(instance=student)


    return render_to_response('base/form.html', locals(), context_instance=RequestContext(request))
Ejemplo n.º 3
0
def student_add(request):
    """
    ДОбавление студента
    """
    result = ''
    if request.method == "POST":
        form = StudentForm(request.POST)
        if form.is_valid():
            if form.save():
                result = 'success'

    else:
        form = StudentForm()
        title = 'Добавление студента'

    return render_to_response('base/form.html',
                              locals(),
                              context_instance=RequestContext(request))
Ejemplo n.º 4
0
def student_edit(request, id):
    """
    Редактирование студента
    """
    result = ''
    student = get_object_or_404(Student, pk=id)
    title = 'Редактирвоание студента %s' % student
    if request.method == "POST":
        form = StudentForm(request.POST, instance=student)
        if form.is_valid():
            if form.save():
                result = 'success'

    else:
        form = StudentForm(instance=student)

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