Skip to content

Instantly share code, notes, and snippets.

@dnfehren
Created June 8, 2012 18:27
Show Gist options
  • Save dnfehren/2897420 to your computer and use it in GitHub Desktop.
Save dnfehren/2897420 to your computer and use it in GitHub Desktop.
collector_app_examples
My app.py has a section like this…
```
@app.route(‘new/<collector_choice>’)
def create_new_collector(collector_choice):
identification_template = render_template(‘identify_template.html’)
return render_template(collector_choice + “.html”, bldg_ident=identification_template
```
The identify_template.html looks like…
```
{% block ident_bldg %}
<fieldset>
<legend>Address </legend>
<label for="street_number">Street Number</label><br />
<input type="text" class="" name="street_number" id="street_number"/>
</p>
<p>
<label for="street_name">Street Name</label><br />
<input type="text" class="" name="street_name" id="street_name"/>
</p>
</fieldset>
{% endblock %}
```
A collector_choice template looks like…
```
<form id="a_form" class="tab_form" action="someaction.php" method="post">
<ul class="tabs">
<li><a class="active" href="#bldg_ident">Identify</a></li>
<li><a href="#part1">Part 1</a></li>
</ul>
<ul class="tabs-content">
<li class="active" id="bldg_ident">
{{ bldg_ident|safe }}
</li>
<li id="part1">
<fieldset>
<legend>Audit Information</legend>
<p>
<label for="sqft">Square Footage</label><br />
<input type="text" class="validate[required]" name="sqft" id="sqft" />
</p>
</fieldset>
</li>
</ul>
</form>
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment