fix db for server
This commit is contained in:
parent
e66729485e
commit
eeacc51ec2
@ -9,12 +9,12 @@ followers = db.Table('followers',
|
|||||||
)
|
)
|
||||||
|
|
||||||
channel_association = db.Table('channel_association',
|
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'))
|
db.Column('user_id', db.Integer, db.ForeignKey('user.id'))
|
||||||
) # Association: CHANNEL --followed by--> [USERS]
|
) # Association: CHANNEL --followed by--> [USERS]
|
||||||
|
|
||||||
twitter_association = db.Table('twitter_association',
|
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'))
|
db.Column('user_id', db.Integer, db.ForeignKey('user.id'))
|
||||||
) # Association: ACCOUNT --followed by--> [USERS]
|
) # Association: ACCOUNT --followed by--> [USERS]
|
||||||
|
|
||||||
|
@ -486,14 +486,16 @@ def allowed_file(filename):
|
|||||||
|
|
||||||
@app.route('/register', methods=['GET', 'POST'])
|
@app.route('/register', methods=['GET', 'POST'])
|
||||||
def register():
|
def register():
|
||||||
count = db.session.query(User).count()
|
|
||||||
if current_user.is_authenticated:
|
if current_user.is_authenticated:
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
|
|
||||||
REGISTRATIONS = True
|
REGISTRATIONS = True
|
||||||
if count >= config['maxInstanceUsers'] or config['maxInstanceUsers'] == 0:
|
try:
|
||||||
REGISTRATIONS = False
|
count = db.session.query(User).count()
|
||||||
|
if count >= config['maxInstanceUsers'] or config['maxInstanceUsers'] == 0:
|
||||||
|
REGISTRATIONS = False
|
||||||
|
except:
|
||||||
|
REGISTRATIONS = True
|
||||||
form = RegistrationForm()
|
form = RegistrationForm()
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
if User.query.filter_by(username=form.username.data).first():
|
if User.query.filter_by(username=form.username.data).first():
|
||||||
|
Reference in New Issue
Block a user