O'Reilly logo

Python Web Development with Django® by Wesley Chun, Jeff Forcier, Paul Bissex

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Photo Gallery

A common feature of many content-driven Web sites is the capability for users to add not only text, but also files—office documents, videos, PDFs, and of course the ubiquitous image. In this example application, we show you a working example of Django’s image upload field—ImageField—as used in a simple gallery-type application. In addition, we make our own custom ImageField subclass capable of automatically generating thumbnails. Finally, we are designing the app with a dynamic root URL to maximize ease of deployment.

The application we are building is simplistic—a collection of generic Items, each of which can have multiple Photo associations, with this small hierarchy represented by a gallery Django project and an items ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required