mrrichardasmith / family_vote

Voting for the Democratic Family
0 stars 0 forks source link

Close Registration #25

Open mrrichardasmith opened 2 years ago

mrrichardasmith commented 2 years ago

As a famly administrator wanting to close the registration feature after all family members are registered shutting the door Given that all the family members that are wanting to participate in the connected family experience have registered their accounts. When accessing the family app configuration panel the option should exist to toggle off the registration page. Then in the future if registration needs to be activated again to extend the membership the registration feature can be toggled back on again.

mrrichardasmith commented 2 years ago

`@app.route('/admin/', methods=['GET', 'POST']) @login_required def admin(username): admin_form = AdminForm() checked = '' if request.method == 'GET': admin = User.query.filter(User.username == username).first() registration = Admin.query.first() print(registration.registration) print(admin.username, admin.admin) confirm_admin = '' if admin.admin == 'admin':

  return render_template('admin.html', admin=admin, admin_form=admin_form, registration=registration)

else:
  print('Supressed Registration Page')
  confirm_admin = False
  return render_template('admin.html', confirm_admin=confirm_admin, admin=NULL)

if request.method == 'POST' and admin_form.validate():

new_admin = Admin.query.get(1)
print(new_admin)
if new_admin.registration == True:
  new_admin.registration = False
else:
  new_admin.registration = True
db.session.commit()
return redirect(url_for('admin', username=current_user.username))

`