Exemplo n.º 1
0
Arquivo: views.py Projeto: derks/dmirr
def create(request):
    data = {}
    if request.method == 'POST':
        form = ArchForm(request.POST)
        if form.is_valid():
            arch = form.save()
            
            return redirect(reverse('manage_archs'))
    else:
        form = ArchForm()
        
    data['form'] = form    
    return render(request, 'archs/create.html', data)
Exemplo n.º 2
0
def create(request):
    data = {}
    if request.method == 'POST':
        form = ArchForm(request.POST)
        if form.is_valid():
            arch = form.save()

            return redirect(reverse('manage_archs'))
    else:
        form = ArchForm()

    data['form'] = form
    return render(request, 'archs/create.html', data)
Exemplo n.º 3
0
Arquivo: views.py Projeto: derks/dmirr
def update(request, arch):
    data = {}
    arch = get_object_or_404(db.Arch, label=arch)

    if request.method == 'POST':
        form = ArchForm(request.POST, instance=arch)
        if form.is_valid():
            arch = form.save()
            return redirect(reverse('manage_archs'))
    else:
        form = ArchForm(instance=arch)
        
    data['form'] = form   
    data['arch'] = arch 
    return render(request, 'archs/update.html', data)
Exemplo n.º 4
0
def update(request, arch):
    data = {}
    arch = get_object_or_404(db.Arch, label=arch)

    if request.method == 'POST':
        form = ArchForm(request.POST, instance=arch)
        if form.is_valid():
            arch = form.save()
            return redirect(reverse('manage_archs'))
    else:
        form = ArchForm(instance=arch)

    data['form'] = form
    data['arch'] = arch
    return render(request, 'archs/update.html', data)