I did step by step to implement sorl-thumbnail
in my Django project. But no migrations thumbnail
created so images do not get added via sending form but still get added by admin interface
.
I use:
What I did.
pip install pillow, sorl-thumbnail
In INSTALLED_APPS
added 'sorl.thumbnail'
In template
Fixed this problem: I had to add this files=request.FILES or None,
in the view function
form = PostForm(
request.POST or None,
files=request.FILES or None,)
if form.is_valid():
form.instance.author = request.user
form.save()
return redirect("posts:profile", request.user.username)
return render(request, 'posts/create_post.html', {'form': form})```