I guess it's what we can call a ForeignKey relationship you described. It's all about SQL , a database problem. For now , I am using sqlalchemy to manage my database.. But it's not supported by GAE I am afraid..
This database schema may help: CREATE TABLE entry ( pk INTEGER NOT NULL, name VARCHAR(200), slug VARCHAR(200), content TEXT, is_public BOOLEAN, category_pk INTEGER, submit_time TIMESTAMP, update_time TIMESTAMP, comment_count INTEGER, click_count INTEGER, PRIMARY KEY (pk), UNIQUE (slug), FOREIGN KEY(category_pk) REFERENCES category (pk) ); Or maybe I just get confused , and didn't catch what you mean.. sorry for the disturb. Blog: http://shiao.org Twitter: @lepture On Fri, May 7, 2010 at 04:13, ProfessionalIT <[email protected]> wrote: > 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] <webpy%[email protected]>. > For more options, visit this group at http://groups.google.com/group/webpy?hl=en. > > -- 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.
