I m starting with webapp2. My english is not very good, so i ll use an example to explain my problem: Suppose i m building an application that will handle cars information.
I ve these handlers:
- ViewHandler: will display a view for a single car, with all of its information (engine, year, brand, model, etc..)
- ListHandler: will display all the cars in the application, with a link to the view page.
问题是,我能够建立这种联系,与单一观点联系起来。
我可以在模板中这样做:
<ul>
<li><a href= /cars/view/{{car.id}} >{{car.model}}</a></li>
</ul>
but don t like that (where s the DRY principle after all?) I was wondering if there s some way to do it similar to django, resolving the URL in the template, like this:
<ul>
<li><a href= {% url cars.view car.id} >{{car.model}}</a></li>
</ul>
Maybe it s not in the template. I ve tryed webapp2.url_for() but didn t help.
感谢很多!