I have a form that allows user to add a title and content for their posts. In content they can upload pictures using tinymce editor like:

enter image description here


class TinyMCEWidget(TinyMCE):
    def use_required_attribute(self, *args):
        return False

class BlogForm(forms.ModelForm):
    title = forms.CharField()
    content = forms.CharField(
            attrs={'required': False, 'cols': 20, 'rows': 10}
    image = forms.ImageField()

    class Meta:
        model = BlogPost
        fields = [

How do I use this picture as thumbnail in ListView. Please help me do it. Thank you so much.

1 Answers

HenryM On

in views.py

class BlogPostList(ListView):
   model = BlogPost

in urls.py

path('blog-list/', BlogPostList.as_view(), name="blog-list")

in blogpost_list.html

{% for object in object_list %}
    <img src=="{{object.image.url}}">
{% endfor %}