= models.CharField(max_length=100) body = models.TextField() tags = models.ManyToManyField('Tag') class Answer(models.Model): question = models.ForeignKey(Question) user = models.ForeignKey('auth.User') title = models.CharField(max_length=100) body = models.TextField() class Tag(models.Model): name = models.CharField(max_length=30)
= models.CharField(max_length=100) body = models.TextField() tags = models.ManyToManyField('Tag') class Answer(models.Model): question = models.ForeignKey(Question) user = models.ForeignKey('auth.User') body = models.TextField() class Tag(models.Model): name = models.CharField(max_length=30)
= models.CharField(max_length=100) body = models.TextField() tags = models.ManyToManyField('Tag') class Answer(models.Model): question = models.ForeignKey(Question) user = models.ForeignKey('auth.User') body = models.TextField() class Tag(models.Model): name = models.CharField(max_length=30)
"JOIN" class Question(models.Model): user = models.ForeignKey('auth.User') {% for question in object_list %} <li> <h3>by {{ question.user.username }}</h3>
ways to start with caching is the cache_page decorator from django.views.decorators.cache import cache_page question_list = cache_page(60)(QuestionsList.as_view())