Django Tutorial - Video 5 - ImageField

This tutorial covers adding images to the django backend as well as changing the database schema to match changes made to a model after the table already exists.


add ImageField to Beer class in beer/models.py

image1          = models.ImageField(upload_to="images/beerthumbs/", help_text="50x180px image")
		

templates/beersall.html

{% extends "base.html" %}
{% block content %}
        <div id="beerslist">
                {% for beer in beers %}
                <p><a href="/beers/{{ beer.slug }}/"><img src="{{ beer.image1.url }}" />{{ beer }}</a></p>
                {% endfor %}
        </div>
{% endblock %}