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))
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) )
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) )
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))
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)
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)
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))
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))