Ejemplo n.º 1
0
def editcust(request,id_cust):
    instance = get_object_or_404(Customer, id=id_cust)
    form = NewCustForm(request.POST or None, instance=instance)
    if form.is_valid():
        form.save()
        return HttpResponseRedirect('/hotel/rooms/')
    return direct_to_template(request, 'hotel/NewCust.html', {'form': form})
Ejemplo n.º 2
0
def newcust(request):
    if request.method == 'POST':
        form = NewCustForm(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect('/hotel/rooms/')
    else:
        form = NewCustForm(initial={'registered': timezone.now() })
    return render(request, 'hotel/NewCust.html', {'form': form})