Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ups!

  • Loading branch information...
commit d022800fe294a2da42e7a339f94e4eaf1fc99c96 1 parent e752b38
MarcMarc authored
View
6 app.py
@@ -13,8 +13,8 @@
from portfelo.contrib.views import main_page
-from portfelo.trans.models import MonthTransactions
-from portfelo.trans.views import current_month
+from portfelo.transactions.models import Month
+from portfelo.transactions.views import current_month
app = Flask(u'portfelo')
app.config.from_pyfile('settings.py')
@@ -23,7 +23,7 @@
def before_request():
g.conn = Connection(app.config['MONGODB_HOST'],
app.config['MONGODB_PORT'])
- g.conn.register([User, MonthTransactions])
+ g.conn.register([User, Month])
g.conn = g.conn.portfelo
g.app = app
View
5 auth/forms.py
@@ -33,7 +33,7 @@ def create_account(self):
class LoginForm(Form):
email = TextField(u'Adres email', [validators.Required(), \
validators.Email(message=u'Wpisz poprawny email!')])
- password = PasswordField(u'Wpisz hasło')
+ password = PasswordField(u'Wpisz hasło', [validators.Required(),])
def __init__(self, *args, **kwargs):
super(LoginForm, self).__init__(*args, **kwargs)
@@ -47,4 +47,5 @@ def validate(self, *args, **kwargs):
self.non_field_errors \
.append(u'Niepoprawna nazwa użyszkodnika lub hasło')
return
- return user
+ self.user = user
+ return True # explicite
View
0  transactions/__init__.py
No changes.
View
35 transactions/models.py
@@ -2,6 +2,8 @@
import datetime
+from pymongo.dbref import DBRef
+
from flask import g
from portfelo.contrib.models import RootDocument
@@ -10,25 +12,26 @@
class Month(RootDocument):
collection_name = u'months'
- structure = {u'user': pymongo.dbref.DBRef,
+ structure = {u'user': DBRef,
u'month': unicode,
u'added': datetime.datetime,
u'modified': datetime.datetime,
- u'transactions': list({'added': datetime.datetime,
- 'modified': datetime.datetime,
- 'amount': int,
- 'category': unicode,
- 'desc': unicode,
- 'type': int,})
-
- required_fields = ['user',
- 'month',
- 'transactions.added',
- 'transactions.modified',
- 'transactions.amount',
- 'transactions.type',]
+ u'transactions': [{u'added': datetime.datetime,
+ u'modified': datetime.datetime,
+ u'amount': int,
+ u'category': unicode,
+ u'desc': unicode,
+ u'type': int,}]
+ }
+
+ required_fields = [u'user',
+ u'month',
+ u'transactions.added',
+ u'transactions.modified',
+ u'transactions.amount',
+ u'transactions.type',]
default_values = {'added': datetime.datetime.utcnow,
'modified': datetime.datetime.utcnow,
- 'transactions.added', datetime.datetime.utcnow,
- 'transactions.modified', datetime.datetime.utcnow,}
+ 'transactions.added': datetime.datetime.utcnow,
+ 'transactions.modified': datetime.datetime.utcnow,}
Please sign in to comment.
Something went wrong with that request. Please try again.