博客系统-后台管理首页

url配置

 url(r'^(?P<username>.*)/backindex/$',views.backIndex),

视图配置:

# 后台管理首页
def backIndex(request,username):
    if not request.user.is_authenticated():     #没有通过验证,直接跳转到收益也
        return redirect("/login/")

    article_obj = models.Article.objects.filter(user__username=username)
    paginator = Paginator(article_obj, 4)
    page_range = paginator.page_range
    num = request.GET.get("page", 1)
    article_obj = paginator.page(num)
    return render(request, "backendindex.html",locals())

前端相关

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{{ request.user.username }}的后台管理首页</title>
    <link rel="stylesheet" href="/static/bootstrap-3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="/static/blog/manmager_page.css">
    <script src="/static/jquery/jquery-3.2.1.min.js"></script>
    <script src="/static/jquery/jquery.cookie.js"></script>

    <script src="/static/kindeditor/kindeditor-all.js"></script>
    <script src="/static/kindeditor/lang/zh-CN.js"></script>


</head>
<body>

<div class="headding">
    <div class="container"><h2>welcome<a href=""> {{ request.user.username }}</a> to myhome_page </h2></div>
</div>
<hr>

<div class="container">
    <div class="row">


        <div class="col-md-3">

            <div class="panel panel-primary">
                <div class="panel-heading"><h2>后台管理页面</h2></div>
                <div class="panel-body">
                    <h3><a href="/blog/{{ request.user.username }}/backindex/">后台管理首页</a></h3>
                    <h3><a href="/blog/{{ request.user.username }}">个人博客主页</a></h3>
                    <h3><a href="/blog/{{ request.user.username }}/backindex/">文章管理</a></h3>
                    <h3><a href="/blog/{{ request.user.username }}/backindex/tags/">标签管理</a></h3>
                    <h3><a href="/blog/{{ request.user.username }}/backindex/category/">分类管理</a></h3>
                </div>
            </div>
        </div>


        <div class="col-md-8">
            {% block manageCon %}
                <div class="panel panel-default">
                    <div class="panel-heading">用户文章信息</div>
                    <div class="panel-body">
                        <a href="/blog/{{ request.user.username }}/backindex/addarticle/">
                    <button class="btn btn-primary">+添加文章</button>
                </a>
                        <table class="table table-bordered table-hover">
                    <tr>
                        <th>编号</th>
                        <th>标题</th>
                        <th>评论数</th>
                        <th>点赞数</th>
                        <th>创建时间</th>
                        <th>编辑</th>
                        <th>删除</th>
                    </tr>
                    {% for article in article_obj %}
                        <tr>
                            <td>{{ forloop.counter }}</td>
                            <td>{{ article.title }}</td>
                            <td>{{ article.comment_count }}</td>
                            <td>{{ article.up_count }}</td>
                            <td>{{ article.create_time }}</td>
                            <td>
                                <a href="/blog/{{ request.user.username }}/backindex/addarticle/"><button class="btn edit btn-info " article_nid="{{ article.nid }}"><span
                                        class="glyphicon glyphicon-pencil">编辑</span></button></a>
                            </td>
                            <td>
                                <button class="btn del btn-danger" article_nid="{{ article.nid }}"><span
                                        class="glyphicon glyphicon-remove">删除</span></button>
                            </td>
                        </tr>
                    {% endfor %}

                </table>
                    </div>
                </div>


                <div class="page_page" style="text-align: center">

                    {#        分页按钮功能#}
                    {% block page %}

                        <nav aria-label="Page navigation">
                            <ul class="pagination">
                                {% if article_obj.has_previous %}
                                    <li>
                                        <a href="/blog/{{ current_user.username }}/backindex/?page={{ article_list.previous_page_number }}"
                                           aria-label="Previous">上一页</a>
                                    </li>
                                {% else %}
                                    <li class="disabled"><a href="" aria-label="Previous">上一页</a></li>
                                {% endif %}


                                {% for index in page_range %}
                                    {% if num == index %}
                                        <li class="active"><a
                                                href="/blog/{{ request.user.username }}/backindex/?page={{ index }}">{{ index }}</a>
                                        </li>
                                    {% else %}
                                        <li>
                                            <a href="/blog/{{ request.user.username }}/backindex/?page={{ index }}">{{ index }}</a>
                                        </li>
                                    {% endif %}
                                {% endfor %}


                                {% if article_obj.has_next %}
                                    <li>
                                        <a href="/blog/{{ request.user.username }}/backindex/?page={{ article_list.next_page_number }}"
                                           aria-label="Previous">下一页</a></li>
                                {% else %}
                                    <li class="disabled"><a href="" aria-label="Previous">下一页</a></li>
                                {% endif %}

                            </ul>
                        </nav>

                    {% endblock %}
                </div>

            {% endblock %}

        </div>


    </div>
</div>


{% block script %}

{% endblock %}

<script>
    $(".table").on("click", ".del", function () {
        $.ajax({
            url: "/blog/{{ request.user.username }}/backindex/delarticle/",
            type: "POST",
            headers: {"X-CSRFToken": $.cookie('csrftoken')},
            data: {
                article_nid: $(this).attr("article_nid")
            },
            success: function (data) {
                var data = JSON.parse(data)
                if (data["is_del"]) {
                    location.href = "/blog/{{ request.user.username }}/backindex/"
                }
            }
        })
    });


</script>


</body>
</html>
# 相关样式操作
.title{ color: #2aabd2; } .article_region .article_con{ margin-left: 20px; } .updown .diggit{ width: 46px; height: 52px; background: url("/static/img/upup.gif") no-repeat; text-align: center; cursor: pointer; margin-top: 2px; padding-top: 5px; } .updown .buryit{ 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; } /*.updown{*/ /*margin-left: 0;*/ /*}*/ .subComment_region #tbCommentAuthor{ background-position: 3px -3px; background-image: url("/static/img/icon_form.gif"); background-repeat: no-repeat; border: 1px solid #ccc; padding: 4px 4px 4px 30px; width: 300px; font-size: 13px; } #commentform_title { background-image: url("/static/img/icon_addcomment.gif"); background-repeat: no-repeat; padding: 0 0 0 25px; margin-bottom: 10px; } .author_avatar{ margin-left: 20px; } .had_comment_region input.author{ background-image: url("/static/img/icon_form.gif"); background-repeat: no-repeat; border: 1px solid #ccc; padding: 4px 4px 4px 30px; width: 300px; font-size: 13px; } #author_profile { float: left; width: 280px; margin-top: 0; margin-bottom: 10px; color: #000; margin-left: 0; font-size: 12px; } .author_profile_info { float: left; line-height: 18px; } div { display: block; } .author_avatar { vertical-align: top; float: left; margin-right: 5px; padding-top: 5px; padding-left: 2px; border: 0; } .author_profile_info { float: left; line-height: 18px; } .author_profile .author_profile_info .author_profile_detail a{ border-bottom: 2px dotted #333; color: #000; text-decoration: none; } .sendMsg2This:link, .sendMsg2This:visited, .sendMsg2This:active { font-size: 12px; text-decoration: none; background: url("/static/img/icoMsg.gif") no-repeat top left; padding-left: 20px; } .feedbackListSubtitle a:hover { color: #f60; text-decoration: none; } .sendMsg2This:hover { background: url("/static/img/icoMsg.gif") no-repeat bottom left; } .sp:hover{ color: #f60; text-decoration: none; } .sp { color: #666; font-weight: normal; } .pl{ margin-left: 0; } .comment{ margin-left: 20px; }

 

转载于:https://www.cnblogs.com/52-qq/p/8669523.html

核心功能 文章/图片/视频发布、喜欢、统计阅读次数。 文章标签tag功能、支持按tag分类 文章支持ueditor/markdown编辑器切换(后台配置) 评论功能,支持回复,支持表情。 第三方(微博、QQ)登录。 lucene实现的站内搜索。 响应式布局 支持用户订阅 先看效果图 SpringBoot开发非常美观的java博客系统(包含后台管理功能) SpringBoot开发非常美观的java博客系统(包含后台管理功能) SpringBoot开发非常美观的java博客系统(包含后台管理功能) http://localhost:8080/admin/group/list SpringBoot开发非常美观的java博客系统(包含后台管理功能) SpringBoot开发非常美观的java博客系统(包含后台管理功能)SpringBoot开发非常美观的java博客系统(包含后台管理功能) 技术选型: JDK8 数据库MySQL 主框架 (Spring-boot、Spring-data-jpa) 安全权限 Shiro 搜索工具 Lucene 缓存 Ehcache 视图模板 Freemarker 其它 Jsoup、fastjson jQuery、Seajs Bootstrap 前端框架 UEditor/Markdown编辑器 font-Awesome 字体/图标 准备工作(sql文件在项目里面) 安装 Jdk8 安装 Maven 准备 IDE (如果你不看源码,可以忽略下面的步骤,直接通过Maven编译war包:mvn clean package -DskipTests) IDE 需要配置的东西 编码方式设为UTF-8 配置Maven 设置Jdk8 关于这些配置,网上有一大把的资料,所以此处不再重复。 获取代码导入到IDE 下载代码 导入到IDE的时候请选择以Maven的方式导入 项目配置参考 系统配置手册 配置完毕 启动项目,在控制台看到Mblog加载完毕的信息后,表示启动成功 打开浏览器输入:http//localhost/mblog/ (此处仅是示例,具体具体端口因人而异),访问成功即部署完毕 后台管理的地址是 /admin, 如果你是管理员账号点导航栏的头像会看到"后台管理" 启动成功后,你应该去后台系统配置里配置你的网站信息等。 常见问题总结 进入系统后, 菜单加载不出来, 那应该是你没有导 db_init.sql 点标签显示乱码, 请设置Tomcat的 URIEncoding 为 UTF-8 项目截图 SpringBoot开发非常美观的java博客系统(包含后台管理功能) 转自:https://gitee.com/mtons/mblog SpringBoot开发非常美观的java博客系统(包含后台管理功能) 注意: 一、java main方式运行mblog-web下的BootApplication.java时抛出异常的解决方案 Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean. SpringBoot开发非常美观的java博客系统(包含后台管理功能) 注释掉后下面图片的这段后,记得maven要重新reimport SpringBoot开发非常美观的java博客系统(包含后台管理功能) SpringBoot开发非常美观的java博客系统(包含后台管理功能) 否则maven依赖不生效还是会抛出以上的异常 二、第三方登录点击后无响应,那是因为第三方开放平台回调的url失效导致,需要你去对应的第三方开放平台注册app后获取对应的oauth帐号 SpringBoot开发非常美观的java博客系统(包含后台管理功能) 三、idea以maven项目导入该项目后,发现没有maven的依赖包时,需要对每个maven module进行clear和install,并且注意maven的依赖顺序 SpringBoot开发非常美观的java博客系统(包含后台管理功能) SpringBoot开发非常美观的java博客系统(包含后台管理功能) 四、访问地址是http://localhost:8080 登录时,帐号,密码只要自己找个密码,然后md5下在更新到db中即可登录成功。 比如:zuidaima 111111,md5后密码是 3931MUEQD1939MQMLM4AISPVNE,md5的java类 SpringBoot开发非常美观的java博客系统(包含后台管理功能) SpringBoot开发非常美观的java博客系统(包含后台管理功能)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值