March 2020
Intermediate to advanced
608 pages
17h 17m
English
In this recipe, we will build upon the products app that we defined in the previous recipe. Follow these steps to get started:
(env)$ pip install django-ordered-model
# myproject/apps/products/models.pyfrom django.db import modelsfrom django.utils.translation import ugettext_lazy as _from ordered_model.models import OrderedModel# …class ProductPhoto(OrderedModel): product = models.ForeignKey(Product, on_delete=models.CASCADE) photo = models.ImageField(_("photo"), upload_to=product_photo_upload_to)order_with_respect_to ...