[web2py] Re: Understanding SQLFORM

2010-08-23 Thread Niphlod
+1 for the latter, I totally forgot to point also the error on form.vars @david, try the last one by mdipierro and tell us if the problem of submitting the form goes away.. Niphlod On 23 Ago, 03:28, mdipierro wrote: > Your code can be simplified as follows: > This is incorrect: >    form.

[web2py] Re: Understanding SQLFORM

2010-08-22 Thread mdipierro
Your code can be simplified as follows: This is incorrect: form.vars.user.writable = False I assume you mean: db.services.user.writable = False It is not a good idea to define a form in a if block, i.e. in a different scope than the the form.accepts. Try this instead: @auth.requires_login()

[web2py] Re: Understanding SQLFORM

2010-08-22 Thread David
That seems to work well with a couple of changes. the writable=False I did in the db model so that it doesn't show at all on the sqlform it was throwing an error in the code so I just removed it. Everything works as expected except for the initial page submit. If the record doesn't exist and I c

[web2py] Re: Understanding SQLFORM

2010-08-22 Thread Niphlod
usually I'll do something like that: 1. @auth.requires_login() 2. def services(): 3.record = db(db.services.user==auth.user.id).select().first() 4.if record: 5.form = SQLFORM(db.services, record, deletable=False) 6.form.vars.user.writable = False 7.else: 8.form