Reputation: 49
I have this block of code in my django project:
<div class="avatar-preview">
<div id="imagePreview" style="background-image: url({{ request.user.img_url }});"></div>
</div>
In Virtual Studio Code, it returns these errors: VSCODE PROBLEMS IMAGE
But it's actually working, I mean, like the 'syntax' is wrong but the code works, the image is displayed correctly. How can I get rid of these errors?
Upvotes: 0
Views: 107
Reputation: 819
url({{ request.user.img_url }})
the {{ request.user.img_url }}
needs to be wrapped in ''
<div class="avatar-preview">
<div id="imagePreview" style="background-image: url('{{ request.user.img_url }}');"></div>
</div>
Upvotes: 1