Esempio n. 1
0
def setJoblist(request):
    obj = Joblist(owner=request.user)
    form = JoblistForm(request.user, request.POST, instance=obj)
    if form.is_valid(): 
        obj = form.save()
        return getJoblistDetail(request.user, obj.id)
    else:
        message = {'joblist': {'error':{ } } }
        for k, v in form.errors.iteritems():
            message['job']['error'][k] = v[0]
        return message
Esempio n. 2
0
def editJoblist(request):
    try:
        obj = Joblist.objects.get(owner=request.user, id=request.POST['id'])
    except:
        return {'joblist': {'error':"Joblist does not exist", } }
    
    form = JoblistForm(request.user, request.POST, instance=obj)
    if form.is_valid(): 
        obj = form.save()
        return getJoblistDetail(request.user, obj.id)
    else:
        message = {'joblist': {'error':{ } } }
        for k, v in form.errors.iteritems():
            message['job']['error'][k] = v[0]
        return message