def customers(): customers = Customer.get_all() if request.method == "POST": customers = Customer.search_all(request.form["search_term"]) return render_template('customer/customers.html', customer_heads=customer_heads, customers=customers)
def test_should_add_customer_given_valid_customer_data_and_LUHP(self): self.login_user(self.admin_user) customer_data = dict(customer_name="Valid Name", address="Valid Address", phone="+123 456 7890", rfc="") with self.client as client: client.post(url_for('customer.add'), data=customer_data) self.assertEqual(len(Customer.get_all()), 2)
def get_autocomplete_data(group, attribute): groups = dict( users=User.get_all(), products=Product.get_all(), customers = Customer.get_all(), expenses=Expense.get_all(), warehouses=Warehouse.get_all() ) data = [] for obj in groups[group]: value = getattr(obj, attribute) if value not in set(data): data.append(value) return data
def test_should_return_list_of_all_customers(self): customers = Customer.get_all() self.assertEqual(customers, [self.customer])