Tutorial by Examples

Let's say you have a simple myblog app with the following model: from django.conf import settings from django.utils import timezone class Article(models.Model): title = models.CharField(max_length=70) slug = models.SlugField(max_length=70, unique=True) author = models.ForeignKe...
Suppose you have a simple Customer model: class Customer(models.Model): first_name = models.CharField(max_length=255) last_name = models.CharField(max_length=255) is_premium = models.BooleanField(default=False) You register it in the Django admin and add search field by first_name...
By default, Django renders ForeignKey fields as a <select> input. This can cause pages to be load really slowly if you have thousands or tens of thousand entries in the referenced table. And even if you have only hundreds of entries, it is quite uncomfortable to look for a particular entry amo...

Page 1 of 1