python - Django 头像类不起作用

标签 python css django avatar

在 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 to True.

要么更改 AVATAR_CACHE_ENABLED 设置,要么清除缓存。

关于python - Django 头像类不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39011004/

相关文章:

javascript - PythonAnywhere 如何处理多个 "web workers"或进程

Python 卡在 pipe.stdin.write(image.tostring())

python - 如何在Python中将txt文件作为数据加载?

html - 阻止 HTML CSS 中的一切模糊

css - 如何仅在主页上删除主菜单?

python - 我怎样才能在我的模板中获取 JSONfield 的值

jquery - 使用 django 和 jquery 创建依赖下拉菜单时遇到问题

python - Pandas - 查找值是否存在,否则保留相同的值

javascript - 用于渲染 HTML 和 javascript 的 Python 库

CSS: <a> 的宽度