vendredi 23 juin 2017

What it's the canonical way of interfacing DB's id with HTML id?

So I'm writing a simple way app. It has SQLite as the RDBMS, Python's bottle framework as server and rest is HTML, CSS and JavaScript.

Now, we all know that HTML tags cannot have id(s) starting with a numeral. And using text/string as primary key in database would be hell.

Right now I'm converting DB id to string and adding an _ before it so it renders correctly in HTML. And doing the reverse when DB needs to be updated. But my code doesn't look beautiful.

So what's the standard accepted way of making these two talk? Where should I implement the translator, in Python or in JavaScript? What background does this problem have in conventional computer science?

Aucun commentaire:

Enregistrer un commentaire