Django : Create custom object list in the view and pass it to template to loop over
问题 I want to create a custom object list in the view and pass it to the template. In the template I want to loop over the list and display the information. My models are class CustomUser(AbstractUser): def __str__(self): return self.email class Post(models.Model): author = models.ForeignKey(CustomUser,on_delete=models.CASCADE,) text = models.TextField() created_date = models.DateTimeField(default=timezone.now) published_date = models.DateTimeField(blank=True, null=True) post_url = models