Thanks Anthony, The links you gave, provided me a clue. Here's the
code I used to serialize the files as links for downloading from my
view-
The changed view looks like below
-----------View ---- posts.html-------------------
{{extend 'layout.html'}}
<h3> Posts </h3>
<hr />
<div id='divcontainer'>
<p>
{{if len(updates):}}
  {{for myupdate in updates:}}
    <p><b>{{=myupdate.description}}</b> </i>{{=myupdate.description}}
</
i>
        <br> Details: {{=A("File", _href=URL('download',
args=adminupdate.file))}} ##This line did the trick
    </p>
  {{pass}}</p>
{{else:}}
  <h5>No new updates available ....</h5>
{{pass}}

Thanks, Rahul

On Dec 21, 9:03 pm, Anthony <[email protected]> wrote:
> 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 --
> seehttp://web2py.com/books/default/chapter/29/7#Storing-the-original-fil....
> 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 --
> seehttp://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