Skip to content

Instantly share code, notes, and snippets.

@davehewy
Created October 2, 2013 15:03
Show Gist options
  • Save davehewy/6795164 to your computer and use it in GitHub Desktop.
Save davehewy/6795164 to your computer and use it in GitHub Desktop.
{% if states[0] is defined %}
{% for state in states %}
{% if state.id == current_state %}
<option value="{{ state.id }}" selected="selected">{{ state.name }}</option>
{% else %}
<option value="{{ state.id }}">{{ state.name }}</option>
{% endif %}
{% endfor %}
{% else %}
{% if states %}
<option value="{{ states.id }}">{{ states.name }}</option>
{% endif %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment