Django阿凡达n级

2024-09-30 05:29:51 发布

您现在位置:Python中文网/ 问答频道 /正文

在django avatar中,我想使用template标签添加一个自定义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>

自定义类不会出现。有什么问题?你知道吗


Tags: django模板imgloadtemplateli标签css
2条回答

这可能是因为应用程序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设置或清除缓存。你知道吗

同样的问题,无法设置^{cl1}$也不知道发生了什么,所以暂时只能通过JavaScript/JQuery进行设置。你知道吗

JQuery查询:

$(function() {$("span.userhome img").addClass("img-responsive")});

相关问题 更多 >

    热门问题