Beispiel #1
0
def booking_new(request):
    form = BookingForm(request.POST or None, instance=Booking())
    
    if form.is_valid():
        form.save()
        return HttpResponseRedirect('/custs/bookings/')
    return render_to_response('custs/booking_new.html',
                              {'booking_form': form},
                              context_instance=RequestContext(request))
Beispiel #2
0
def booking_edit(request, pk):
    booking = get_object_or_404(Booking, pk=pk)
    form = BookingForm(request.POST or None, instance=booking)
    
    if form.is_valid():
        form.save()
        return HttpResponseRedirect('/custs/bookings/')
    return render_to_response('custs/booking_edit.html',
                              {'booking_form': form,
                               'booking_id': pk},
                              context_instance=RequestContext(request))