在 django-avatar 中,我想使用模板标签添加自定义 CSS 类,但它不起作用。
我的模板:
{% load avatar_tags %}
<li>
<span class="userhome">
{% avatar user 50 class="mmb-img" id="user_avatar" %}
Welcome : {{ user.username }}
</span>
</li>
呈现的 HTML 是:
<li>
<span class="userhome">
<img src="https://www.gravatar.com/avatar/4bbcb352e5bdbe63fe8f9a5786ea9d69/?s=50" alt="cpoudevigne" width="50" height="50">
Welcome : cpoudevigne
</span>
</li>
自定义类没有出现。有什么问题?
最佳答案
这可能是因为应用 caches the output of those template tags :
AVATAR_CACHE_ENABLED
Set to
False
if you completely disable avatar caching. Defaults toTrue
.
要么更改 AVATAR_CACHE_ENABLED
设置,要么清除缓存。
关于python - Django 头像类不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39011004/