Beispiel #1
0
def machine_create(request):
    form = MachineForm(request.POST or None)
    if request.method == 'POST':
        if form.is_valid():
            machine = form.save()
            return HttpResponseRedirect(machine.get_absolute_url())

    return render(template_name='karaage/machines/machine_form.html',
                  context=locals(),
                  request=request)
Beispiel #2
0
def machine_create(request):
    form = MachineForm(request.POST or None)
    if request.method == 'POST':
        if form.is_valid():
            machine = form.save()
            return HttpResponseRedirect(machine.get_absolute_url())

    return render_to_response('karaage/machines/machine_form.html',
                              locals(),
                              context_instance=RequestContext(request))
Beispiel #3
0
def machine_edit(request, machine_id):
    machine = get_object_or_404(Machine, pk=machine_id)

    form = MachineForm(request.POST or None, instance=machine)
    if request.method == 'POST':
        if form.is_valid():
            machine = form.save()
            return HttpResponseRedirect(machine.get_absolute_url())

    return render(template_name='karaage/machines/machine_form.html',
                  context=locals(),
                  request=request)