Python 型号不’;不显示在管理中
我目前正在写一个科学博客django。我已经完成了所有的编码,我意识到模型项概述和内容没有出现在我的django.admin中。这是一张你可以看到的图片。 我知道还有其他相关的线索。然而,我在这些问题上找不到解决办法 Models.py:Python 型号不’;不显示在管理中,python,django,Python,Django,我目前正在写一个科学博客django。我已经完成了所有的编码,我意识到模型项概述和内容没有出现在我的django.admin中。这是一张你可以看到的图片。 我知道还有其他相关的线索。然而,我在这些问题上找不到解决办法 Models.py: class Post(models.Model): title = models.CharField(max_length=100) overview = models.TextField() timestamp = models.D
class Post(models.Model):
title = models.CharField(max_length=100)
overview = models.TextField()
timestamp = models.DateTimeField(auto_now_add=True)
content = HTMLField()
author = models.ForeignKey(Author, on_delete=models.CASCADE)
thumbnail = models.ImageField()
categories = models.ManyToManyField(Category)
featured = models.BooleanField()
previous_post = models.ForeignKey(
'self', related_name='previous', on_delete=models.SET_NULL, blank=True, null=True)
next_post = models.ForeignKey(
'self', related_name='next', on_delete=models.SET_NULL, blank=True, null=True)
Admin.py:
from django.contrib import admin
from .models import Author, Category, Post, Comment, PostView
# Register your models here.
admin.site.register(Author)
admin.site.register(Category)
admin.site.register(Post)
Settings.py:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'crispy_forms',
'tinymce',
'marketing',
'posts'
]
和url.py:
urlpatterns = [
path('admin/', admin.site.urls),
顺便说一下,models.py在应用程序帖子中。以防有人需要这些信息
其他模型工作得很好。这只是概述和内容使用以下内容:-
content = models.TextField()
而不是:-
content = HTMLField()
然后进行迁移,迁移添加这些字段后是否进行了迁移?添加Url并迁移…文档:-。测试你的HTMLField:-是的,我做了迁移,我会做的。问题是我需要tinymce来写文章。@Marcgames\u YT如果你需要在django admin中写文章,请使用django ckeditor 6.0.0。这是最好的…更多细节文档:-我刚刚上传了它。它比TinyMCE好多了。谢谢你告诉我