Ejemplo n.º 1
0
def create_company():
    company_name = request.form['name']
    company_industry = request.form['industry']
    
    company = Company(company_name, company_industry)
    company_repository.save(company)

    return redirect('/companies')
def create_company():
  name = request.form['name']
  amount = request.form['amount']
  category = category_repository.select(request.form['category_id'])
  account = account_repository.select(request.form['account_id'])
  add_company = Company(name, amount, category, account)
  company_repository.save(add_company)
  account.amount -= float(amount)
  account_repository.update(account)
  return redirect('/')
Ejemplo n.º 3
0
from models.user import User 
from models.account import Account

import repositories.category_repository as category_repository
import repositories.company_repository as company_repository
import repositories.user_repository as user_repository
import repositories.account_repository as account_repository


account_repository.delete_all()
user_repository.delete_all()
category_repository.delete_all()
company_repository.delete_all()

user1 = User("David Taylor", 137)
user_repository.save(user1)

category1 = Category("Shopping")
category_repository.save(category1)

account1 = Account('Bank of Scotland', 380)
account_repository.save(account1)

company1 = Company("Tesco", 50, category1, account1)
company_repository.save(company1)

print(company1)


pdb.set_trace()
from models.tag import Tag
import repositories.tag_repository as tag_repository

from models.budget import Budget
import repositories.budget_repository as budget_repository

transaction_repository.delete_all()
company_repository.delete_all()
tag_repository.delete_all()
budget_repository.delete_all()

total_budget = Budget(0.00)
budget_repository.save(total_budget)

company_1 = Company("RailScot")
company_repository.save(company_1)

company_2 = Company("Pilot Beer")
company_repository.save(company_2)

company_3 = Company("WideNation")
company_repository.save(company_3)

company_4 = Company("Blub")
company_repository.save(company_4)

company_5 = Company("Amoosin Primula")
company_repository.save(company_5)

company_6 = Company("Blumen Ecke")
company_repository.save(company_6)
def create_company():
    name = request.form["name"]
    new_company = Company(name)
    company_repository.save(new_company)
    return redirect("/companies")