Tutorial ~~~~~~~~ .. note:: This tutorial is intended for a reader that is well versed in the Django basics of the ORM, urls routing, function based views, and templates. It is also expected that you have already installed iommi in your project. Read section 1 of :ref:`Getting started `. This tutorial will build a discography app. Let's start with the models: .. literalinclude:: models.py :pyobject: Artist :end-before: def __str__ .. literalinclude:: models.py :pyobject: Album :end-before: def __str__ .. literalinclude:: models.py :pyobject: Track :end-before: def __str__ We will build up to these pages: - index page with album artwork - an artist page - an artists page - an album page - an albums page - a tracks page Plus we're going to enable the iommi admin for these models. Example data ------------ If you want it to get the same example data as in this tutorial, run `this code`_. .. _this code: https://raw.githubusercontent.com/iommirocks/iommi/master/docs/custom/big_discography.py Tables ------ Creating a table view of a model in iommi is simple: .. code-block:: python urlpatterns = [ path('', Table(auto__model=Album).as_view()), ] .. raw:: html
▼ Hide result
You get sorting and pagination by default, and we're using the default bootstrap 5 style. iommi ships with :ref:`more styles