Skip to content

Commit

Permalink
updated requirements, added flask-admin
Browse files Browse the repository at this point in the history
  • Loading branch information
drewverlee committed Feb 17, 2013
1 parent ffe1d40 commit eae7315
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
20 changes: 11 additions & 9 deletions petalapp/database/models.py
Expand Up @@ -172,16 +172,19 @@ class UserSurveySection(db.Model):
"""
id = db.Column(db.Integer, primary_key=True)
completed_date = db.Column(db.DateTime)
time_period = db.Column(db.Integer)
due = db.Column(db.DateTime)
assigned = db.Column(db.DateTime)
answers = db.relationship('Answer', backref='user_survey_section',
lazy='dynamic')
survey_section_id = db.Column(db.Integer, db.ForeignKey('survey_section.id'))
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
data_id = db.Column(db.Integer, db.ForeignKey('data.id'))


def __init__(self,time_period, completed_date=datetime.datetime.utcnow()):
self.completed_date = completed_date
def __init__(self, due=None, assigned=None, completed=None): #datetime.datetime.utcnow())
self.due = due
self.assigned = assigned
self.completed = completed

def __repr__(self):
return '<completed on: %r>' % self.completed_date
Expand All @@ -196,19 +199,18 @@ class Answer(db.Model):
"""
id = db.Column(db.Integer, primary_key=True)
numeric = db.Column(db.Integer)
text = db.Column(db.String(500))
tf = db.Column(db.Boolean)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
question_option_id = db.Column(db.Integer, db.ForeignKey('question_option.id'))
unit_of_measurement_id = db.Column(db.Integer, db.ForeignKey('unit_of_measurement.id'))
user_survey_section_id = db.Column(db.Integer, db.ForeignKey('user_survey_section.id'))


def __init__(self, numeric=0):
def __init__(self, numeric=None, text=None, tf=None):
self.numeric = numeric

#TODO a dynamic one?
def __repr__(self):
return '<Answer numeric: %r>' % self.numeric

self.tf = tf
self.text = text

class UnitOfMeasurement(db.Model):
"""
Expand Down
4 changes: 3 additions & 1 deletion petalapp/views.py
Expand Up @@ -66,7 +66,7 @@ def logout():

#

@app.route('/survey', methods = ['GET', 'POST'])
@app.route('/old_survey', methods = ['GET', 'POST'])
@contributer_permission.require(403)
@login_required
def survey():
Expand Down Expand Up @@ -99,6 +99,8 @@ def survey():
total = sum([int(x) for x in session['question_values']]))


@app.route('/survey', methods = ['Get'])

#
@app.errorhandler(404)
def internal_error(error):
Expand Down
8 changes: 3 additions & 5 deletions prod-requirements.txt
@@ -1,14 +1,14 @@
Babel==0.9.6
Flask==0.9
Flask-Admin==1.0.4
Flask-Babel==0.8
Flask-Bcrypt==0.5.2
Flask-BrowserID==0.0.1
Flask-Login==0.1.3
Flask-Mail==0.7.3
Flask-OpenID==1.1
Flask-Principal==0.3.3
Flask-S3==0.1.1
Flask-SQLAlchemy==0.16
Flask-SSLify==0.1.4
Flask-Testing==0.4
Flask-WTF==0.8
Jinja2==2.6
Expand All @@ -25,12 +25,10 @@ decorator==3.4.0
flask-heroku==0.1.3
## FIXME: could not find svn URL in dependency_links for this package:
flup==1.0.3.dev-20110405
gunicorn==0.17.2
gunicorn==0.15.0
ipython==0.13.1
matplotlib==1.1.1
psycopg2==2.4.5
py-bcrypt==0.2
python-openid==2.2.5
pytz==2012h
requests==1.0.4
speaklater==1.3
Expand Down

0 comments on commit eae7315

Please sign in to comment.