Beispiel #1
0
def save_task(request):
    if request.POST:
        form = TaskForm(request.POST)
        if form.is_valid():
            form.save()

    template='salidatask.html'
    data={}
    return render_to_response(template, data, context_instance=RequestContext(request))
Beispiel #2
0
def pruebasave(request):

    # example de ajaxForm
    if request.POST:
        form = TaskForm(request.POST)
        if form.is_valid():
            form.instance.creator=Employee.objects.get(user=request.user)
            form.save()
            output = "ok"
    else:
        output = "Post needed"

    data={'output':output,}
    template='salidaprueba.html'
    return render_to_response(template, data, context_instance=RequestContext(request))
Beispiel #3
0
def save(request):
    """
    Save the task and shows a little ajax ok

    """
    if request.POST:
        form = TaskForm(request.POST)
        if form.is_valid():
            t = form.save(commit=False)
            t.creator=Employee.objects.get(user=request.user)
            t.save()
 
    template='salidaprueba.html'
    data={}
    return render_to_response(template, data, context_instance=RequestContext(request))