This is the code in my controller
form = SQLFORM.factory(Field('list_name', 'string', label='List Name'), db.
project, table_name='project',upload=URL('download'))
for t in db.project:
query = (t.id == request.vars.id)
__copydata(db(query).select(limitby=(0,1)).first(), form.vars, t.fields)
and this is in view
<div>{{=form}}</div>
Anthony於 2016年2月26日星期五 UTC+8上午12時19分03秒寫道:
>
> Can you show the code you are using to edit an existing record via
> SQLFORM.factory?
>
> On Thursday, February 25, 2016 at 10:50:12 AM UTC-5, killzane wrote:
>>
>> Yes, I mean when I want to edit an existing record, there are no link.
>> But I can find the file when use appadmin.
>>
>> Anthony於 2016年2月25日星期四 UTC+8下午10時41分32秒寫道:
>>>
>>> There should only be a file link if you are editing an existing record
>>> (with an existing file). If you are displaying a "create" form, to what
>>> file would you expect such a link to point?
>>>
>>> Anthony
>>>
>>> On Thursday, February 25, 2016 at 4:19:10 AM UTC-5, killzane wrote:
>>>>
>>>> This is my code
>>>> form = SQLFORM.factory(Field('list_name', 'string', label='List Name'),
>>>> db.project, table_name='project',upload=URL('download'))
>>>>
>>>> And here is my db.py about upload field
>>>> Field('project_pdf', 'upload', label='Project PDF', comment='',
>>>> uploadfolder='app/uploads'),
>>>>
>>>> When I use web2py's appadmin I can see the link like this picture
>>>>
>>>>
>>>> <https://lh3.googleusercontent.com/-OJc7GOyH4DM/Vs7GiuCdwVI/AAAAAAAAxVk/PZu2h_N-dC0/s1600/1.PNG>
>>>>
>>>>
>>>>
>>>> but in my view I use
>>>> {{=form}}
>>>>
>>>> There are only choose file but not file link
>>>>
>>>> how could I do for it?
>>>>
>>>
--
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.