What does it mean "not working". Do you get a traceback? What does it say?

On Friday, 20 March 2015 10:02:57 UTC-5, Ariya Owam-aram wrote:
>
> Dear all,
>
> I implement conditions models but it seem to broken function download for 
> display image from upload fields.
> let say:
>
> ######################
> # in models/01_defind_table.py
> ######################
> class Pd_product_sku(BaseModel):
>     def __init__(self, db):
>         self.db             = db
>         self.tablename      = "pd_product_sku"
>         
>         self.fields = [
>             Field('code',
>                   length    = '50',
>                   label     = T('SKU Code'),
>                   notnull   = True,
>                   requires = IS_NOT_IN_DB(db, 'pd_product_sku.code')),
>             Field('image', 'upload',
>                   label     = T('Image'),
>                   uploadfolder = 
> os.path.join(request.folder,'static/pd_product_sku'),
>                   requires  = IS_EMPTY_OR(
>                     IS_IMAGE(maxsize = (1200, 1200),error_message = 'The 
> maximum image dimension allowed for upload is 1200 x 1200px!')) ),
>             ]
>
>         self.params         = dict(
>             migrate         = True,
>             #fake_migrate    = True,
>             singular        = T('SKU'),
>             plural          = T('SKU'),      
>             format          = '%(code)s : %(name)s'
>             )  
>
> ######################
> # in models/default/test/01.py
> ######################
> pd_product_sku= Pd_product_sku(db)
> pd_product_sku.define_table()
>
> ######################
> # in controller/default.py
> ######################
> def test():
> # pd_product_sku
>     db.pd_product_sku.image.represent = lambda v, r: 
> IMG(_src=URL('default', 'download', args=v) )
>     grid= SQLFORM.grid(db.pd_product_sku)
>     return dict(grid=grid)
>
>     ||
>     ||
>     ||
>     v
>
> IMG(_src=URL('default', 'download', args=v) not working 
> but if I define pd_product_sku in the normal environment (model/db.py) is 
> work as narmal.
>
>
> Please advise, and thank you in advance
>
> Ariya
>
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to