Friends,
I'm trying solve my problem...
ps: I'm running my app in GAE.
in forms.py:
result = data.all_categories()
# args = [(row.id, row.title) for row in result] >>> give error in
GAE, because isn't accessible.
# args = [(row.key().id(), row.title) for row in result] >>> run in
GAE and populate the form, but in the save give error.
args = [(row.title, row.title) for row in result]
new_post = form.Form(
form.Dropdown('category', args),
form.Textbox('title'),
form.Textarea('text'),
form.Dropdown('language', [('pt', 'Portuguese'), ('en',
'English')]),
form.Button('Submit!')
)
in code.py:
# run OK.
class Post:
@requires_admin
def GET(self):
frm = forms.new_post()
return render.full(render.form(frm))
@requires_admin
def POST(self):
global last_updated
frm = forms.new_post()
if frm.validates():
data.save_entry(frm.d)
last_updated = data.last_updated()
raise web.seeother('/')
else:
return render.full(render.form(frm))
class Edit:
@requires_admin
def GET(self, slug):
entry = data.entry_by_slug(slug)
frm = forms.new_post()
# >>>>> here occours the problem/error.
# I think that this method fill can't not receive a GAE
object, a entry object have a category object associated.
frm.fill(entry)
return render.full(render.form(frm))
@requires_admin
def POST(self, slug):
frm = forms.new_post()
entry = data.entry_by_slug(slug)
if not form.validates():
return render.full(render.form(frm))
data.salve_entry(frm.d)
raise web.seeother('/')
- Any idea ?
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.