first commit

main
谢英豪 9 months ago
parent edfcc247ed
commit f8452f1ed2

@ -6,7 +6,6 @@ User = get_user_model()
class BlogCategory(models.Model):
name = models.CharField(max_length=200, verbose_name='分类名称')
class Blog(models.Model):
title = models.CharField(max_length=200, verbose_name='标题')
content = models.TextField(verbose_name='内容')
@ -15,7 +14,6 @@ class Blog(models.Model):
author = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name='作者')
class BlogComment(models.Model):
content = models.TextField(verbose_name='内容')
pub_time = models.DateTimeField(auto_now_add=True, verbose_name='发布时间')
@ -23,4 +21,3 @@ class BlogComment(models.Model):
author = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name='作者')

@ -2,9 +2,57 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<title>{% block title %}{% endblock %}</title>
<link rel="stylesheet" href=" {% static 'bootstrap5/bootstrap.min.css' %}">
<script src=" {% static 'bootstrap5/popper.min.js' %}"></script>
<script src=" {% static 'bootstrap5/bootstrap.min.js' %}"></script>
<link rel="stylesheet" href=" {% static 'css/base.css' %}">
{% block head %}{% endblock %}
</head>
<body>
<header class="p-3 text-bg-secondary border-bottom mb-3">
<div class="container">
<div class="d-flex flex-wrap align-items-center justify-content-center justify-content-lg-start">
<a href="/" class="d-flex align-items-center mb-2 mb-lg-0 text-white text-decoration-none">
<img src="{% static 'image/logo1.png' %}" alt="">
</a>
<ul class="nav col-12 col-lg-auto me-lg-auto mb-2 justify-content-center mb-md-0">
<li><a href="/" class="nav-link px-2 text-white">论坛首页</a></li>
<li><a href="{% url 'blog:pub_blog' %}" class="nav-link px-2 text-white">发布</a></li>
<li><a href="#" class="nav-link px-2 text-white">Pricing</a></li>
<li><a href="#" class="nav-link px-2 text-white">FAQs</a></li>
<li><a href="#" class="nav-link px-2 text-white">About</a></li>
</ul>
<form class="col-12 col-lg-auto mb-3 mb-lg-0 me-lg-3" role="search">
<input type="search" class="form-control form-control-dark text-white" placeholder="搜索..."
aria-label="Search" _mstplaceholder="99723" _mstaria-label="74607">
</form>
{% if user.is_authenticated %}
<div class="dropdown text-end">
<a href="#" class="d-block link-body-emphasis text-decoration-none dropdown-toggle"
data-bs-toggle="dropdown" aria-expanded="false">
<img src="{% static 'image/profile.png' %}" alt="mdo" width="32" height="32" class="rounded-circle">
</a>
<ul class="dropdown-menu text-small" style="">
<li><a class="dropdown-item" href=" {% url 'auth1:logout' %} ">退出登录</a></li>
</ul>
</div>
{% else %}
<div class="text-end">
<a href="{% url 'auth1:login' %}" type="button" class="btn btn-outline-primary me-2">登录</a>
<a href="{% url 'auth1:register' %}" type="button" class="btn btn-primary">注册</a>
</div>
{% endif %}
</div>
</div>
</header>
<main class="container bg-white p-3 rounded">
{% block main %}{% endblock %}
</main>
</body>
</html>
Loading…
Cancel
Save