django-admin自定义功能按钮样式
位置在原来的django-admin 栏中的上方【会因为屏幕大小而变换位置】
<!-- 这里是不会替换掉旧的 添加按钮 ,而是添加多一个按钮【点击Crawl Data】-->
<!-- /home/luichun/lc/Pyfile/Pywebback/app/paqu/templates/admin/yourmodel_changelist.html -->
{% extends "admin/change_list.html" %}
{% block object-tools %}
{{ block.super }}
<div class="object-tools">
<ul class="object-tools">
<li>
<a href="{% url 'admin:crawl-data' %}">点击Crawl Data</a>
<a href="{% url 'admin:crawl-data' %}" class="button">点击Crawl Data</a>
<a href="{% url 'admin:crawl-data' %}" class="addlink">增加 crawled data</a>
<a href="{% url 'admin:crawl-data' %}" class="addlink">增加 crawled data</a>
<a href="{% url 'admin:crawl-data' %}" class="add-related">增加 crawled data</a>
<a href="{% url 'admin:crawl-data' %}" style="color: white; background: linear-gradient(270deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #8b00ff); background-size: 1400% 1400%; animation: rainbow 10s ease infinite; padding: 5px 10px; border-radius: 5px; text-decoration: none;">点击Crawl Data</a>
<a href="{% url 'admin:crawl-data' %}" style="color: white; background: linear-gradient(270deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #8b00ff); background-size: 1400% 1400%; animation: rainbow 10s ease infinite; padding: 5px 10px; border-radius: 20px; text-decoration: none;">点击Crawl Data</a>
<a href="{% url 'admin:crawl-data' %}" style="color: white; background: linear-gradient(270deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #8b00ff); background-size: 1400% 1400%; animation: rainbow 10s ease infinite; padding: 5px 10px; border-radius: 50%; text-decoration: none;">点击Crawl Data</a>
<a href="{% url 'admin:crawl-data' %}" class="addlink" style="color: white; background: linear-gradient(270deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #8b00ff); background-size: 1400% 1400%; animation: rainbow 10s ease infinite; padding: 5px 10px; border-radius: 20px; text-decoration: none;">点击Crawl Data</a>
<a href="{% url 'admin:crawl-data' %}" class="add-related" style="color: white; background: linear-gradient(270deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #8b00ff); background-size: 1400% 1400%; animation: rainbow 10s ease infinite; padding: 5px 10px; border-radius: 20px; text-decoration: none;">点击Crawl Data</a>
<style>
@keyframes rainbow {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
</style>
</li>
</ul>
</div>
{% endblock %}
<h1>Debug: Template Loaded</h1>
彩虹渐变效果–位置在原来的django-admin 栏中的下方
<!-- 这里是不会替换掉旧的 添加按钮 ,而是添加多一个按钮【点击Crawl Data】-->
<!-- /home/luichun/lc/Pyfile/Pywebback/app/paqu/templates/admin/yourmodel_changelist.html -->
{% extends "admin/change_list.html" %}
{% block object-tools %}
{{ block.super }}
<!-- <a href="{% url 'admin:crawl-data' %}" class="addlink">增加 crawled data</a> -->
<a href="{% url 'admin:crawl-data' %}" class="addlink" style="color: white; background: linear-gradient(270deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #8b00ff); background-size: 1400% 1400%; animation: rainbow 10s ease infinite; padding: 5px 10px; border-radius: 20px; text-decoration: none; position: relative;">点击Crawl Data</a>
{% endblock %}
{% block extrahead %}
{{ block.super }}
<style>
@keyframes rainbow {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
</style>
{% endblock %}
<h1>Debug: Template Loaded</h1>