Hi. I'm trying to build an a simple CRUD admin section of my application. Basically, for a given Model, I want to have a template loop through the model's attributes into a simple table (once I do this, I can actually implement the CRUD part). A possible way to accomplish this is to dynamically generate a template with all the necessary template tags specific to that model.
Pseudocode:
def generate_tamplate(model):
template.write("<table border='1'>")
template.write("<tr>")
for attribute in model:
template.write("<td>%s</td>" % attribute)
template.write("</tr>")
template.write("<tr>")
for attribute in model:
template.write("<td>{{ %s.%s }}</td>" % model.attribute)
template.write("</tr>")
template.write("</table>")
Generating the proper text should not be difficult. I can follow my pseudocode model and do it Python. Two things im wondering: 1) Can I do this instead using Django's templating language? that is, use a template to generate a template 2) Once I generate the text, how can I wrote that to a file that webapp's template loader can access?
I remember a while back seeing something about loading template from the database. Is this possible with GAE?
THANKS!