Question: I'm just starting coding in Django and I have code that repeat itself on a lot of pages.

for example:

```
<select name="seasons" id="season-id">
    {% for season in seasons %}
        {% if season_id|add:0 == season.id %}
            <option value="{{ season.id }}" selected="selected">{{ season.name }}</option>
        {% else %}
            <option value="{{ season.id }}">{{ season.name }}</option>
        {% endif %}
    {% endfor %}
</select>

```

In previous language I could use view helpers to make it more DRY. How can I accomplish this in Django.

Answer: 
Depends on what is repeating. 

1. You can nest templates. Probably not useful here.
2. You can write your own template tags and template filters. [further info](http://www.pfinn.net/custom-django-filter-tutorial.html)
You shouldn't be writing this template code at all. You should define a Django form and let that output the field.