Exemplo n.º 1
0
def add_tray(request):
    tray_form=None;
    if request.method == 'POST':
        tray_form=TrayForm(request.POST)
        if tray_form.is_valid():
            tray_form.save()
            return redirect(reverse('cm_trays_view'))
    else:
        tray_form=TrayForm()

    return render_to_response(
       'intranet/caffeine_manager/trays/edit_tray.html',
       {
         'section':'intranet',
         'page':'caffeine',
         'form':tray_form
       }, context_instance=RequestContext(request))
Exemplo n.º 2
0
def edit_tray(request, trayId):
    tray=get_object_or_404(Tray, pk=trayId)
    if request.method == 'POST':
        tray_form=TrayForm(request.POST, instance=tray)
        if tray_form.is_valid():
            tray_form.save()
            return redirect(reverse('cm_trays_view'))
    else:
        tray_form=TrayForm(instance=tray)

    return render_to_response(
       'intranet/caffeine_manager/trays/edit_tray.html',
       {
         'section':'intranet',
         'page':'caffeine',
         'form':tray_form,
         'id':trayId
       }, context_instance=RequestContext(request))
Exemplo n.º 3
0
def add_tray(request):
    tray_form = None
    if request.method == 'POST':
        tray_form = TrayForm(request.POST)
        if tray_form.is_valid():
            tray_form.save()
            return redirect(reverse('cm_trays_view'))
    else:
        tray_form = TrayForm()

    return render_to_response('intranet/caffeine_manager/trays/edit_tray.html',
                              {
                                  'section': 'intranet',
                                  'page': 'caffeine',
                                  'form': tray_form
                              },
                              context_instance=RequestContext(request))
Exemplo n.º 4
0
def edit_tray(request, trayId):
    tray = get_object_or_404(Tray, pk=trayId)
    if request.method == 'POST':
        tray_form = TrayForm(request.POST, instance=tray)
        if tray_form.is_valid():
            tray_form.save()
            return redirect(reverse('cm_trays_view'))
    else:
        tray_form = TrayForm(instance=tray)

    return render_to_response('intranet/caffeine_manager/trays/edit_tray.html',
                              {
                                  'section': 'intranet',
                                  'page': 'caffeine',
                                  'form': tray_form,
                                  'id': trayId
                              },
                              context_instance=RequestContext(request))