예제 #1
0
def show(request, client_id):
    user = user_auth(request)
    client = get_object_or_404(TimeshitClient, id = client_id, user = user)
    projects = TimeshitProject.objects.filter(client = client)
    return render_to_response('projects/index.html',
                              {'client': client, 'projects': projects},
                              context_instance = RequestContext(request))
예제 #2
0
def edit(request, client_id):
    user = user_auth(request)
    client = get_object_or_404(TimeshitClient, id=client_id, user=user)
    return render_to_response('clients/edit.html',
                              {'client': client},
                              context_instance = RequestContext(request)
                             )
예제 #3
0
def index(request):
    user = user_auth(request)
    clients = TimeshitClient.objects.filter(user = user)
    return render_to_response('clients/index.html',
                              {'clients': clients},
                              context_instance = RequestContext(request)
                             )
예제 #4
0
def show(request, client_id):
    user = user_auth(request)
    client = get_object_or_404(TimeshitClient, id=client_id, user=user)
    projects = TimeshitProject.objects.filter(client=client)
    return render_to_response('projects/index.html', {
        'client': client,
        'projects': projects
    },
                              context_instance=RequestContext(request))
예제 #5
0
def update(request, client_id):
    user = user_auth(request)
    instance = get_object_or_404(TimeshitClient, id=client_id)
    form = TimeshitClientForm(request.POST, instance = instance)
    if form.is_valid():
        client = form.save(commit = False)
        if client.user != user:
            return ajax_no_perm()
        client.save()
        return ajax_response('Client updated', {
            'model': 'client',
            'id': client.id,
            'name': client.name,
            'redirectUrl': '/clients/',
        })
    return ajax_response("Form is not valid", serialize_form_errors(form), code = 1)
예제 #6
0
def update(request, client_id):
    user = user_auth(request)
    instance = get_object_or_404(TimeshitClient, id=client_id)
    form = TimeshitClientForm(request.POST, instance=instance)
    if form.is_valid():
        client = form.save(commit=False)
        if client.user != user:
            return ajax_no_perm()
        client.save()
        return ajax_response(
            'Client updated', {
                'model': 'client',
                'id': client.id,
                'name': client.name,
                'redirectUrl': '/clients/',
            })
    return ajax_response("Form is not valid",
                         serialize_form_errors(form),
                         code=1)
예제 #7
0
def edit(request, client_id):
    user = user_auth(request)
    client = get_object_or_404(TimeshitClient, id=client_id, user=user)
    return render_to_response('clients/edit.html', {'client': client},
                              context_instance=RequestContext(request))
예제 #8
0
def index(request):
    user = user_auth(request)
    clients = TimeshitClient.objects.filter(user=user)
    return render_to_response('clients/index.html', {'clients': clients},
                              context_instance=RequestContext(request))