I want to display images according to the user's first and second letter from the username instead of an image with rounded corners. But
<div> {{Post.author.username.0} } </div>
Returns only the first letter instead. Please help, how do I return 2 letters for example: Ahmed as Ah instead of A.
You can use the |slice
template filter [Django-doc] to construct a substring with the first two characters:
{{ Post.author.username|slice:":2" }}