-
Notifications
You must be signed in to change notification settings - Fork 0
/
notes
96 lines (62 loc) · 2.09 KB
/
notes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Keep user's data in the database, and later tell the users that the association with your fund and fund ID from moneycontrol is not with us, but will be updated very very soon. This should work for now I guess.
TODO:
High level:
Better Display of data
Good colour scheme - use bootstrap
Nice layout of homepage
def to prettify rupees
def to make fund appear not all capitalized
Code cleanup
Move all the configurable options into a config file
remove all todos and create issues on github for them
remove unwanted methods
organize code
write unit tests!!!!
remove circular imports
db initialization script
Deploy on server
use puppet?
Additional features
dropdown and not textbox for fund
login with facebook
provide interface to add new funds with their fund IDs
implement all todos
Install flask, flask-sqlalchemy extensions
sudo pip install flask
sudo pip install Flask-SQLAlchemy
Database url:
mysql://root:nova@localhost/<databasename>
How to use database from code
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(80), unique=True)
email = db.Column(db.String(120), unique=True)
def __init__(self, username, email):
self.username = username
self.email = email
def __repr__(self):
return '<User %r>' % self.username
db.create_all()
#Boom, and there is your database. Now to create some users:
admin = User('admin', 'admin@example.com')
guest = User('guest', 'guest@example.com')
txn = TxnRaw('blah', 'fake_house', 11.1, 1.1, 20141122, 12, 31)
#But they are not yet in the database, so lets make sure they are
#db.session.add(admin)
#db.session.add(guest)
#db.session.add(txn)
#db.session.commit()
#Accessing the data in database is easy as a pie:
users = User.query.all()
#[<User u'admin'>, <User u'guest'>]
admin = User.query.filter_by(username='admin').first()
print users
print admin
print admin.username
print admin.email
txns = TxnRaw.query.filter_by(user_id=1).all()
print [txn.date for txn in txns]
### Jinja
pip install Jinja2
install beautifulsoup
sudo pip install beautifulsoup4