BBS项目分布搭建四(点赞点踩及评论功能)

本文详细介绍了BBS项目中点赞点踩和评论功能的实现过程,包括前端和后端逻辑的编写,以及相关样式的准备。通过五个步骤,逐步展示了如何在项目中集成这些关键交互功能。
摘要由CSDN通过智能技术生成

1. 点赞点踩样式准备

# 在base.html文件中 head标签内 添加css模块:
    {% block css %}

    {% endblock %}



# 修改 article_detail.html内容:
{% extends 'base.html' %}

{% block css %}
    <style>
        #div_digg {
            float: right;
            margin-bottom: 10px;
            margin-right: 30px;
            font-size: 12px;
            width: 125px;
            text-align: center;
            margin-top: 10px;
        }

        .diggit {
            float: left;
            width: 46px;
            height: 52px;
            background: url(/static/img/upup.gif) no-repeat;
            text-align: center;
            cursor: pointer;
            margin-top: 2px;
            padding-top: 5px;
        }

        .buryit {
            float: right;
            margin-left: 20px;
            width: 46px;
            height: 52px;
            background: url(/static/img/downdown.gif) no-repeat;
            text-align: center;
            cursor: pointer;
            margin-top: 2px;
            padding-top: 5px;
        }

        .clear {
            clear: both;
        }

        .diggword {
            margin-top: 5px;
            margin-left: 0;
            font-size: 12px;
            color: #808080;
        }

    </style>
{% endblock %}


{% block content %}
    <h1>{
  { article_detail.title }}</h1>
    <div class="article_content">
        {
  { article_detail.content|safe }}
    </div>

    {#    点赞点踩样式开始#}
    <div class="clearfix">
        <div id="div_digg">
            <div class="diggit active">
                <span class="diggnum" id="digg_count">{
  { article_detail.up_num }}</span>
            </div>
            <div class="buryit active">
                <span class="burynum&
  • 5
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值