On Thursday, December 19, 2013 9:06:27 PM UTC-8, Cliff wrote:
>
> Hi Dave
>
> Thanks for the reply! That was somewhat the path I was on. I like the 
> boolean idea. Where I am hung up now though is how I would list all the 
> bowl games on a page then update picks, like how i mentioned before. Would 
> I be able to use SQLFORM to do this? This is my database setup, i have kept 
> it simple for now.
>
>
As a start, you might look at Loic's answer he linked in to the other 
thread.  Your database should be small enough that Anthony's concern won't 
be a problem.
<http://stackoverflow.com/questions/20697034/how-can-i-join-3-tables-and-output-a-the-all-three-together-joined-in-web2py/20698864#20698864>

(I use SQLFORM in my current, but just for a simple table; the trickiest 
thing I do is figuring out maxid so I can limit the range of the table.)
 

>
> db.define_table('persons', Field('person'), Field('email'))
> db.define_table('teams', Field('teamname'), Field('winner', 'boolean', 
> default=False))
> db.define_table('bowls', Field('name'), Field('team1', 'reference 
> teams'),Field('team2', 'reference teams'), Field('gametime', 'date')) 
> db.define_table('picks', Field('person', 'reference persons'), 
> Field('pick', 'reference teams'))
> db.persons.email.requires = IS_EMAIL()
> db.picks.person.requires = IS_IN_DB(db, db.persons.id, '%(person)s')
> db.bowls.team1.requires = IS_IN_DB(db, db.teams.id, '%(teamname)s')
> db.bowls.team2.requires = IS_IN_DB(db, db.teams.id, '%(teamname)s')
>
> On Thursday, December 19, 2013 2:30:20 PM UTC-5, Cliff wrote:
>>
>> Hello.
>>
>> General question here. Me and some friends guess who is going to win 
>> NCAAF bowl games so I thought I would try and make an app for it. So I 
>> started off making a table for users, games, picks. 
>>
>> Users -> Person name | email
>> bowls -> Bowl name | team 1 | team 2 | time | winner
>> picks - > person (reference user) | pick (reference unsure) 
>>
>> What I would like to do is make a page with an arg for user where I can 
>> enter their picks and it store it in a DB for that user. An example would 
>> be Bowl game 1: Team 1 vs Team 2 then a drop down list or radio button to 
>> select the team. Bowl game 2: team 1 vs team 2 drop down list to select the 
>> team etc etc.. Then later be able to list what user is ahead by wins. What 
>> I am getting caught up with is how to setup my databases. 
>>
>> If someone could point me in the right direction I would greatly 
>> appreciate it. 
>>
>

/dps

 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to