Exemplo n.º 1
0
def del_customer(request, customerID):
	success, cust = priv_apis.del_customer(request, customerID)
	if success:
		message = 'Customer ' + cust.name + ' has been successfuly deleted.'
	else:
		message = 'Customer ' + cust.name + ' FAILED to delete.'
	return priv_site_views.customers(request, message = message)
Exemplo n.º 2
0
def create_customer(request):
	name = request.POST['name']
	address = request.POST['address']
	if (name != '') and (address != ''):
		c= Customer(name= name, address = address)
		c.save()
	return priv_site_views.customers(request)
Exemplo n.º 3
0
def create_contact(request, customerID):
	cust = Customer.objects.get(pk=customerID)
	name = request.POST['name']
	email = request.POST['email']
	phone = request.POST['phone']
	cont = Contact(customer = cust, name = name, email= email, phone = phone)
	cont.save()
	return priv_site_views.customers(request, customerID)
Exemplo n.º 4
0
def create_project(request, customerID):
	cust = Customer.objects.get(pk=customerID)
	name = request.POST['project_name']
	start_date = request.POST['start_date']
	end_date = request.POST['end_date']
	hourly_rate = request.POST['hourly_rate']
	est_costs = request.POST['estimated_costs']
	p = Project(name = name, customer = cust, start_date=start_date, end_date = end_date, hourly_rate = hourly_rate, estimated_costs = est_costs)
	p.save()
	return priv_site_views.customers(request, customerID)