自定义管理Django

时间:2016-02-22 20:20:49

标签: django django-admin

我正在尝试创建个人登录屏幕模板,但无法正常工作。

https://github.com/rg3915/custom-admin

我配置了设置:

'DIRS': [os.path.join(BASE_DIR, 'templates_admin')],

创建文件夹e templates

https://github.com/rg3915/custom-admin/tree/master/myproject/core/templates_admin/admin

但不行。

1 个答案:

答案 0 :(得分:0)

文档https://docs.djangoproject.com/en/1.9/ref/contrib/admin/#admin-overriding-templates 通知只需创建文件夹templates / admin / inner app,在我的例子中是myproject / core /

在这种情况下,应用程序的顺序很重要。

<?php
    query("
        SELECT
            rcr.rank_name AS rank,
            u.id,
            u.username
        FROM
            roleplay_corporations rc
        LEFT JOIN
            roleplay_corporations_ranks rcr
        ON
            rcr.corp_id = rc.id
        LEFT JOIN
            user_roleplay_stats urs ON urs.job_rank = rcr.rank_id
        LEFT JOIN
            users u 
        ON 
            urs.user_id = u.id
        WHERE
            rc.id = 1 AND urs.job_id = 1
        GROUP BY
             rcr.rank_id, u.username
    ");

    ?>
    <div>
        <?php while($r = $rank->fetch_object()){ ?>
        <div>
            <div>
                <h2 class="title"><?php echo $r->rank; ?></h2>
                <div class=>
                foreach of the users with this rank, loop and display each of their usernames
                <?php echo $r->username;?> // this displays their username, however it gives each record their own div box with the same rank name
                </div>
            </div>
        </div>
        <?php } ?>
    </div>`