On Aug 25, 9:33 am, "Jorge Vargas" <[EMAIL PROTECTED]> wrote: > On Mon, Aug 25, 2008 at 2:19 AM, Boštjan Jerko <[EMAIL PROTECTED]> wrote: > > > I'd like to change field in the database when I click the button on > > the page. I've "connected" python script in the kid template to the > > button > > but I don't know how to access table from the database in the kid template. > > Please do not do this, it violates the MVC architecture, you should be > doing that in the controller code and then pass the result to the > templates for display.
Actually, the original idea of MVC would be that the View pulls the data it needs from the Model, which is exactly what Boštjan seems to be attempting. More recently, people have mischaracterised MVC as having the Controller be some sort of mediator between the View and the Model. (http://martinfowler.com/eaaDev/uiArchs.html). Personally I find the original way makes more sense: the View knows which aspects of the Model it needs to display and queries for them accordingly, and the Controller just handles input logic, not having to concern itself with which parts of the Model it needs to expose to the View. Controllers and Views can vary independently. But yes, certainly this way is not the TurboGears way, which is fair enough. -- Ben Sizer --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---

