[web2py] Re: Default value of two references only one gets the value

2015-12-22 Thread Greenpoise
Fixed it by normalizing the tables. I had a duplicate with suppliercode.

Thanks

On Tuesday, December 22, 2015 at 3:08:08 PM UTC-8, Anthony wrote:
>
> db.define_table('supplier',
>> Field('suppliercode',requires=IS_UPPER()),
>> format='%(suppliercode)s')
>>
>> db.define_table('series',
>> Field('seriesname'),
>> Field('seriesdescription',requires=IS_UPPER())...
>>
>> db.define_table('product',
>>Field('series', 'reference series'),
>>Field('suppliercode','reference supplier', default=db.supplier.id)...
>>
>>
>> Shouldnt the fields series and suppliercode automatically populate in the 
>> grid? Right now only series populates itself.
>>
>
> What do you mean by "automatically populate in the grid"? The grid shows 
> records that have already been inserted. Did the records in question have 
> the expected values when inserted?
>
> Note, you do not define a default for the "series" field. Also, the 
> default for the "suppliercode" field must either be a value or a function 
> that generates a value -- it should not be a field object.
>
> Anthony
>

-- 
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/d/optout.


[web2py] Re: Default value of two references only one gets the value

2015-12-22 Thread Anthony

>
> db.define_table('supplier',
> Field('suppliercode',requires=IS_UPPER()),
> format='%(suppliercode)s')
>
> db.define_table('series',
> Field('seriesname'),
> Field('seriesdescription',requires=IS_UPPER())...
>
> db.define_table('product',
>Field('series', 'reference series'),
>Field('suppliercode','reference supplier', default=db.supplier.id)...
>
>
> Shouldnt the fields series and suppliercode automatically populate in the 
> grid? Right now only series populates itself.
>

What do you mean by "automatically populate in the grid"? The grid shows 
records that have already been inserted. Did the records in question have 
the expected values when inserted?

Note, you do not define a default for the "series" field. Also, the default 
for the "suppliercode" field must either be a value or a function that 
generates a value -- it should not be a field object.

Anthony

-- 
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/d/optout.