mercredi 25 novembre 2015

Passing variables from Jinja to database

I'm trying to figure out a way to pass a dynamic URL structure into a python function that will render a Jinja template with information about the information that was passed. Specifically I have a item database that should be able to take whatever item ID is in the URL and render a template with further information about that item.

To simply the problem, I've hardcoded the value 1043374545 for demonstrations purposes, but I'm hoping that this line will be come dynamic once this initial problem is solved.

urls = ('/1043374545', 'view_item')

class view_item:
    def GET(self, itemID):
        item_info = sqlitedb.detailInfo(request)
        return render_template('view_item.html', item = item_info)

As of now I isolated the issue to having to do with something related to passing the value 1043374545 into the view_item function. Any thoughts on how I can pass a dynamic number within a URL into view_item?

Aucun commentaire:

Enregistrer un commentaire