Re: [web2py] Re: one to many relationship

2015-08-10 Thread Yebach
To create one to many form i tried to follow the post from this guy http://blog.jotbe-fx.de/articles/2522/web2py-Normalized-many-to-many-model-with-multiselect-drop-down Also to create the dropdown etc. The thing worked kind of but the problem was that my grid was not getting populated once yo

Re: [web2py] Re: one to many relationship

2015-08-10 Thread Vid Ogris
Postgres. The thimg is i have no table files. They somehow got deleted On Aug 11, 2015 12:30 PM, "Dave S" wrote: > > > On Monday, August 10, 2015 at 7:32:31 PM UTC-7, Yebach wrote: >> >> Thank you for detailed answer >> >> I am trying to implement this in SQLFORM? Looks like multiple option is >>

Re: [web2py] Re: one to many relationship

2015-08-10 Thread Dave S
On Monday, August 10, 2015 at 7:32:31 PM UTC-7, Yebach wrote: > > Thank you for detailed answer > > I am trying to implement this in SQLFORM? Looks like multiple option is > not avaliable, the field is presented as text field in the form > > BTW - why web2py does not add new field to a table. If

Re: [web2py] Re: one to many relationship

2015-08-10 Thread Vid Ogris
Thank you for detailed answer I am trying to implement this in SQLFORM? Looks like multiple option is not avaliable, the field is presented as text field in the form BTW - why web2py does not add new field to a table. If I set migrate to True I get an error "table already exists" if it is set to

[web2py] Re: one to many relationship

2015-08-07 Thread Lisandro
Hi there. Web2py has some cool field types called "list:string", "list:integer" and "list:reference table". Check them here: http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Field-types In your case, you could avoid the creation of the third table with *list:refer

[web2py] Re: one to many relationship DB structure

2013-10-16 Thread raferbop
I am going to give it a go right now. On Wednesday, October 16, 2013 7:18:33 PM UTC-5, Anthony wrote: > > Actually, I'm not sure this is the right data model. Presumably the > product table should include just one record per product, so you don't want > to store a sale id in the product table. I

[web2py] Re: one to many relationship DB structure

2013-10-16 Thread Anthony
Actually, I'm not sure this is the right data model. Presumably the product table should include just one record per product, so you don't want to store a sale id in the product table. If each sale can include only one product, then you want a product reference field in the sale table. If each

[web2py] Re: one to many relationship DB structure

2013-10-16 Thread raferbop
Thanks Anthony, the default argument, which I am assuming is "default=auth.user_id", inserts the user id into the sales table. But what argument should I use to insert the sale_id into the products table, very much in the same way the default=auth.user_id inserst the user id in the db.sale.

[web2py] Re: one to many relationship DB structure

2013-10-16 Thread Anthony
> > db.sale.user_id.requires = IS_IN_DB(db, 'auth_user.id') > The above line is unnecessary, as you get the IS_IN_DB validator automatically by default. > This is an improvement on what I had. But I am not sure if I applied the > code correctly because the 'user_id' and 'sale_id' have been c

[web2py] Re: one to many relationship DB structure

2013-10-16 Thread raferbop
db.define_table( 'sale', Field('user_id', db.auth_user), Field('start_date', 'date', requires=IS_DATE()), Field('end_date', 'date', requires=IS_DATE()), Field('start_time', 'time', requires = IS_TIME()), Field('end_time', 'time', requires = IS_TIME())) db.sale.user_id.requi

[web2py] Re: one to many relationship DB structure

2013-10-16 Thread Cliff Kachinske
This is a problem: db.define_table( 'sale', Field('id', db.auth_user, default=auth.user_id), How about this instead: db.define_table( 'sale', Field('user_id', db.auth_user, requires=IS_IN_DB( # See "Forms and Validators in the Fine Manual Also do this: db.define_table( 'prod

[web2py] Re: one to many relationship DB structure

2013-10-16 Thread raferbop
Thanks Stifan, But that doesn't work either, because the product_id now displays in the sale form. I need to generate the sale_id first, and then have sow in the product table/form. Right now, it just shows up blank. On Wednesday, October 16, 2013 11:08:58 AM UTC-5, 黄祥 wrote: > > yeah, my pov

[web2py] Re: one to many relationship DB structure

2013-10-16 Thread 黄祥
yeah, my pov is because your product never save the sale id. imho, i think your code should be : db.define_table( 'sale', Field('product_id', 'reference product'), Field('user_id', db.auth_user, default=auth.user_id), Field('start_date', 'date', requires=IS_DATE()), Field('end_

[web2py] Re: one to many relationship but Foreign key as non-id,unique field.

2010-08-08 Thread mdipierro
No. But you can enforce the reference at the web2py level with the IS_IN_DB validator. On Aug 8, 2:36 am, Phyo Arkar wrote: > Yes i understand that 1 to Many do not link to Field but Record but i need > to Reference to a Field which is not id  . > so with that i can set two primary keys but i wan

Re: [web2py] Re: one to many relationship but Foreign key as non-id,unique field.

2010-08-08 Thread Phyo Arkar
Yes i understand that 1 to Many do not link to Field but Record but i need to Reference to a Field which is not id . so with that i can set two primary keys but i want to reference to EmailID (which is not auto increment Integer but a md5sum , string , Unique) . Is that possible? On Sun, Aug 8,

[web2py] Re: one to many relationship but Foreign key as non-id,unique field.

2010-08-08 Thread qqsaqq
as I understand this, the DAL always uses the id field for referencing in a one to many relationship. And: you don't link to a certain field (EmailID) but to a record of your emails table. see http://web2py.com/book/default/chapter/06#Legacy-Databases-and-Keyed-Tables On Aug 8, 8:00 am, Phyo Arka