Closed crisfcodes closed 4 years ago
I try to access the cropped image in the frontend but it throws up the following error:
Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 3.0.7 Exception Type: AttributeError Exception Value: 'str' object has no attribute '_meta'
class Banner(models.Model): """Main banner image of the page.""" image = models.ImageField(blank=True, null=True, upload_to="banners") cropping = ImageRatioField("image", "800x360") title = models.CharField("Tittle", max_length=68) class Meta: verbose_name = "Banner" verbose_name_plural = "Banners" ordering = ["created"] def __str__(self): return self.title
<img src="{% cropped_thumbnail Banner "cropping" %}" alt="{{ image }}">
Error
I try to access the cropped image in the frontend but it throws up the following error:
Model
Frontend