diff --git a/app/models.py b/app/models.py index 25d4d83..7b6a4c6 100644 --- a/app/models.py +++ b/app/models.py @@ -9,12 +9,12 @@ followers = db.Table('followers', ) channel_association = db.Table('channel_association', - db.Column('channel_id', db.String, db.ForeignKey('channel.id')), + db.Column('channel_id', db.String(30), db.ForeignKey('channel.id')), db.Column('user_id', db.Integer, db.ForeignKey('user.id')) ) # Association: CHANNEL --followed by--> [USERS] twitter_association = db.Table('twitter_association', - db.Column('account_id', db.String, db.ForeignKey('twitterAccount.id')), + db.Column('account_id', db.String(30), db.ForeignKey('twitterAccount.id')), db.Column('user_id', db.Integer, db.ForeignKey('user.id')) ) # Association: ACCOUNT --followed by--> [USERS] diff --git a/app/routes.py b/app/routes.py index 2f58d96..07be4ea 100644 --- a/app/routes.py +++ b/app/routes.py @@ -486,14 +486,16 @@ def allowed_file(filename): @app.route('/register', methods=['GET', 'POST']) def register(): - count = db.session.query(User).count() if current_user.is_authenticated: return redirect(url_for('index')) REGISTRATIONS = True - if count >= config['maxInstanceUsers'] or config['maxInstanceUsers'] == 0: - REGISTRATIONS = False - + try: + count = db.session.query(User).count() + if count >= config['maxInstanceUsers'] or config['maxInstanceUsers'] == 0: + REGISTRATIONS = False + except: + REGISTRATIONS = True form = RegistrationForm() if form.validate_on_submit(): if User.query.filter_by(username=form.username.data).first():