It's work!
Thanks!
Anthony於 2016年3月1日星期二 UTC+8上午2時24分48秒寫道:
>
> The default value should be the file name, but you don't have to set it
> when you define the table in the model. Instead, set the default in the
> controller right *before* you create the form:
>
> db.project.project_pdf.default =
The default value should be the file name, but you don't have to set it
when you define the table in the model. Instead, set the default in the
controller right *before* you create the form:
db.project.project_pdf.default = the_file_name
Simply setting form.vars.project_pdf will not work.
Anth
So if I have this field in db.project
Field('project_pdf', 'upload', label='Project PDF', comment='', uploadfolder
='app/uploads'),
I must change to
Field('project_pdf', 'upload', label='Project PDF', comment='', uploadfolder
='app/uploads', default=''),
what content should I put in "default" att
The widget gets created when the form is initialized, so if you want to
specify a value for the file URL, you should do it by setting the "default"
attribute of the upload field in the db.project table *before* creating the
table.
Anthony
On Sunday, February 28, 2016 at 10:07:28 AM UTC-5, kill
I want to modify a record from db.project, and there are a reference field
in db.project.
So I use SQLFORM.factory to add field to put reference list name.
the code I paste is simplify version
here is full code
form = SQLFORM.factory(Field('list_name', 'string', label='List Name'), db.
project, d
Sorry, still not clear what you are trying to do, and you have not
explained why you are iterating over the Fields of the db.project table.
On Sunday, February 28, 2016 at 3:48:26 AM UTC-5, killzane wrote:
>
> Because I want to add other field to the form so I use SQLFORM.factory.
>
> And this is
Because I want to add other field to the form so I use SQLFORM.factory.
And this is my __copydata method
def __copydata(src, dest, fields):
if src:
for k in fields:
if src.has_key(k):
dest[k] = src[k]
return dict()
Anthony於 2016年2月26日星期五 UTC+8下午9時08分1
> for t in db.project:
> query = (t.id == request.vars.id)
> __copydata(db(query).select(limitby=(0,1)).first(), form.vars,
> t.fields)
>
The above is confusing and cannot be the actual code, as it would raise an
exception. When you iterate over db.project, you get its Field objects (
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.field
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日
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
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 = SQL
12 matches
Mail list logo