On Wednesday, December 21, 2011 5:54:43 AM UTC-5, Rahul wrote:
>
>     form = crud.create(db.updates) 
>     if form.accepts(request.vars, session):
>

FYI, crud.create() automatically handles the form processing, so you do not 
need to do form.accepts() when using Crud (only when using FORM or SQLFORM 
directly).
 

> Query - How do I serialize the view to show a link to files attached. 
> For example in above code, it should show me the file name (original 
> would be good or a general name like say - FILE ) as hyperlink to 
> download the same.  With the current code it shows me only the name of 
> the encoded file and does not allow me to download (i.e no links)
>

If you want to show the filename, it might be easiest to store it 
separately -- 
see http://web2py.com/books/default/chapter/29/7#Storing-the-original-filename. 
Alternatively, you can manually decode it from the encoded filename, which 
is of the form table.field.[16 char uuid].[b16encoded filename].[extension].

To create a link, you can use the download() function (or if you have 
uploaded to the static folder, you can directly link to the file). There 
are ways to automatically link to files in update/view forms -- 
see http://web2py.com/books/default/chapter/29/7#SQLFORM-and-uploads, 
http://web2py.com/books/default/chapter/29/3#An-image-blog.

Anthony
 

Reply via email to