def create(): from gluon.tools import Crud #Hide the fields that should not be accessable by the user hideFields(db.game, ['host_id', 'game_status', 'password', 'winner_id', 'rules']) #Run the form #form = SQLFORM(db.game) #form.add_class('assassins-form') #form.vars.host_id=auth.user.id #Create the form crud = Crud(db) crud.messages.submit_button = 'Create Game' form = crud.create(db.game) form.add_class('assassins-form') form.vars.host_id = auth.user.id #When the form is submitted, add the creator as a player and go to new game if form.process().accepted: joinGame(form.vars.id, auth.user) resizeImage(db.game, form.vars.id) redirect(URL('default', 'game', args=form.vars.id)) return dict(form=form)
def create(): from gluon.tools import Crud #Hide the fields that should not be accessable by the user hideFields (db.game, ['host_id', 'game_status', 'password', 'winner_id', 'rules']) #Run the form #form = SQLFORM(db.game) #form.add_class('assassins-form') #form.vars.host_id=auth.user.id #Create the form crud = Crud(db) crud.messages.submit_button = 'Create Game' form = crud.create(db.game) form.add_class('assassins-form') form.vars.host_id=auth.user.id #When the form is submitted, add the creator as a player and go to new game if form.process().accepted: joinGame(form.vars.id, auth.user) resizeImage(db.game, form.vars.id) redirect(URL('default', 'game', args=form.vars.id)) return dict(form=form)
def user(): from atools import hideFields if 'profile' in request.args: redirect(URL('default', 'settings')) hideFields(db.auth_user, ['image', 'theme']) return dict(form=auth())
def user(): from atools import hideFields if 'profile' in request.args: redirect(URL('default', 'settings')) hideFields (db.auth_user, ['image', 'theme']) return dict(form=auth())
def settings(): #Set the text and picture for the polaroid image = getImage(auth.user.image) hideFields(db.auth_user, ['id', 'theme', 'password']) form = SQLFORM(db.auth_user, auth.user.id) form.add_class('assassins-form') if form.process().accepted: resizeImage(db.auth_user, form.vars.id) #update the session cache auth.user.first_name = form.vars.first_name auth.user.last_name = form.vars.last_name auth.user.image = form.vars.image redirect(URL('default', 'settings')) return dict(form=form, image=image)
def settings(): #Set the text and picture for the polaroid image = getImage(auth.user.image) hideFields (db.auth_user, ['id', 'theme', 'password']) form=SQLFORM(db.auth_user, auth.user.id) form.add_class('assassins-form') if form.process().accepted: resizeImage(db.auth_user, form.vars.id) #update the session cache auth.user.first_name = form.vars.first_name auth.user.last_name = form.vars.last_name auth.user.image = form.vars.image redirect(URL('default', 'settings')) return dict(form=form, image=image)