Django模型字段未显示在管理页面中

时间:2020-06-10 18:45:15

标签: django model field

我是Django的初学者,尝试在Django Admin页面上加载所有模型字段时遇到麻烦。我在设置页面中正确添加了应用程序,对管理页面进行了相对导入,并成功地将模型显示在管理页面中,但是问题是大多数时候,我输入的字段都丢失了。我通常只显示最后一两个,只有当它们是TextFields时才显示。

This is all the Fields I enter into the text editor

But this is all I end up seeing

2 个答案:

答案 0 :(得分:0)

尝试删除大多数行后面的“,”

tiltle = models.Texfield()

答案 1 :(得分:0)

forms.py使用此

from yourApp.models import Product 
class ProductForm(ModelForm):
    class Meta:
        model = Product
        fields = '__all__'

和models.py不能使用>>,<<

例如:

class Product(models.Model):

    fields1 = models.CharField(max_length=100)
    fields2 = models.CharField(max_length=100)
    tiltle = models.Texfield()