修改了article数据库,成功

This commit is contained in:
跨越晨昏 2024-09-20 20:27:38 +08:00
parent 196ed6920c
commit ae0600ba51
4 changed files with 6 additions and 6 deletions

View File

@ -21,7 +21,7 @@ class ArticleInfo(models.Model):
author = models.ForeignKey(MyUser, on_delete=models.CASCADE, verbose_name='用户') author = models.ForeignKey(MyUser, on_delete=models.CASCADE, verbose_name='用户')
title = models.CharField('标题', max_length=200) title = models.CharField('标题', max_length=200)
content = RichTextUploadingField(verbose_name='内容') content = RichTextUploadingField(verbose_name='内容')
rendered = RichTextUploadingField(verbose_name='最终内容') rendered = RichTextUploadingField(verbose_name='最终内容', default='<p>默认内容</p>')
articlephoto = models.ImageField('文章图片', blank=True, upload_to='images/article/') articlephoto = models.ImageField('文章图片', blank=True, upload_to='images/article/')
reading = models.IntegerField('阅读量', default=0) reading = models.IntegerField('阅读量', default=0)
liking = models.IntegerField('点赞量', default=0) liking = models.IntegerField('点赞量', default=0)

View File

@ -47,12 +47,12 @@ article {
position: relative; position: relative;
z-index: 1 z-index: 1
} }
.r_box { .m_box {
/* 主体CSS样式规则 */ /* 主体CSS样式规则 */
float: center; /* 让这个aside元素向右浮动 */ float: center; /* 让这个aside元素向右浮动 */
width: 60%; /* 设置宽度为父容器的20% */ width: 60%; /* 设置宽度为父容器的20% */
background-color: #f0f0f0; /* 设置背景颜色为浅灰色 */ background-color: #f0f0f0; /* 设置背景颜色为浅灰色 */
margin-left: 100px; /* 设置右边距为20px */ margin-left: 1000px; /* 设置右边距为20px */
overflow: hidden; overflow: hidden;
display: block; display: block;
position: relative; position: relative;

View File

@ -2,7 +2,7 @@
{% load static %} {% load static %}
{% block content %} {% block content %}
<main class="r_box"> <main class="m_box">
{% for list in pageInfo.object_list %} {% for list in pageInfo.object_list %}
<li> <li>
<i><a href="{% url 'detail' id list.id %}"> <i><a href="{% url 'detail' id list.id %}">
@ -15,7 +15,7 @@
<h3> <h3>
<a href="{% url 'detail' id list.id %}">{{ list.title }}</a> <a href="{% url 'detail' id list.id %}">{{ list.title }}</a>
</h3> </h3>
<p>{{ list.content|safe }}</p> <p>{{ list.rendered|safe }}</p>
</li> </li>
{% endfor %} {% endfor %}

View File

@ -20,7 +20,7 @@
</div> </div>
<div class="news_con"> <div class="news_con">
{{ ats.content|safe }} {{ ats.rendered|safe }}
</div> </div>
</div> </div>