A league will most definitely needs its own database instead of a table ...
while a team can have its own table within that league database !!! ... but
can a database be created on the fly within the app upon registration ??
On Wednesday, 20 June 2012 10:02:27 UTC-4, Don_X wrote:
>
> Hello,
>
> In the model, in the file db.py I used the auth_user table that comes by
> default with web2py and I enriched it a bit the following way :
> ########################################
> db.define_table('auth_user',
> Field('first_name', type='string',
> label=T('First Name')),
> Field('last_name', type='string',
> label=T('Last Name')),
> Field('email', type='string',
> label=T('E-mail')),
> Field('password', type='password',
> readable=False,
> label=T('Password')),
> Field('sex',requires=IS_IN_SET((T('male'),T('female'))),label=T('My
> Sex is')),
> Field('usertype',requires=IS_IN_SET((T('player'),T('coach'),T(
> 'referee'),T('Parent, Soccer Fan or Volunteer'),T('League, Club, School
> or Team owner'),T('OTHER (ex: Health,Sponsor,etc)'))),
> label=T('I am a')),
> Field('birth_date','date',label=T('Birth Date')),
> Field('created_on','datetime',default=request.now,
> label=T('Created On'),writable=False,readable=False),
> Field('modified_on','datetime',default=request.now,
> label=T('Modified On'),writable=False,readable=False,
> update=request.now),
> Field('registration_key',default='',
> writable=False,readable=False),
> Field('reset_password_key',default='',
> writable=False,readable=False),
> migrate=settings.migrate)
>
>
> I am using mysql on my local server, it all works ! the problem or issue I
> am having is this :
> In the usertype field, I have 6 predefined user types ...
> 1) I wanted to user numbers ( like 1, 2, ... 6) internally to shorten the
> various codes I'll be writting when it comes to compare or to decide on the
> actions of that specific usertype !
> (PS. I am thinking that it is somekind of a list so I can refer
> to that field as auth_user.usertype[0 to 5] to identify the specific
> usertype of a subscriber !!! ... am I on the right track ??? )
>
> 2) *** THIS IS MY MOST IMPORTANT QUESTION ***
> Depending on that user type, the associated profile and form to fill out
> that follow will not be the same upon registration !! ... in other words,
> depending on the usertype chosen by the user, as I am using the form wizard
> recipe,
> the next steps ( and certain fields ) to be shown will not be the same ...
> so .. I definitely need to create separate table for each user type ????
> ... what if a specific user type ( such as a club and a league) actually
> needs its own database instead of a table in my main database ! ??? how do
> I approach this in the model and consequently in the controller to the view
> ???
> To put it in context : a player or ref or coach is a user, ( simple ) ...
> and most club owners and persons will be the same basic auth_user ! but on
> the other hand ...
> a team is a list of registered users
> a club is a list of teams and users ( that
> are not teams )
> a league is a list of clubs and users ( that
> are not clubs, like volunteers, workers, etc.. )
>
> Am i approaching this the right way ??? ...
>
> please advise
>
> thank you