On 4/7/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > So, at the suggestion of several people on the list today, I figured > out the basics of using form widgets. So now my little toy learning > application (a wish list) is all widgety. Neat stuff. However, my > design for this program relies on the same sort of new/not new status > for the list items that the wiki20 tutorial uses to tell the "save" > class how to handle the form data. I can't for the life of me figure > out how to implement that sort of mechanism using the widgets. I tried > a ton of different things, and none of them work. Any guidance would be > appreciated.
That's actually a really good question. The first answer that comes up: do it the way the 20 minute wiki *will* do it in the next iteration: don't bother with a flag. Have the edit method catch SQLObjectNotFound and add a record if that's the case. The next answer is to use a FieldSet. What I'm about to say is heading off into fuzzy territory for me, because I haven't played much with FieldSets. (Michele and Alberto will undoubtedly correct me if I'm wrong on this one). Let's say, in the wiki20 case, you've got a FieldSet for the wiki page instance (we'll call that fieldset "page"). Your form would have that fieldset plus the hidden field. You'd pass to your template a dictionary that looks like this: dict(formdata=dict(page=page, new=new)) I'm not spelling out the widget stuff, since it sounds like you're comfortably using widgets right now. Kevin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" 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/turbogears -~----------~----~----~----~------~----~------~--~---

