Home > Mobile >  Admin page shows only one model field of many
Admin page shows only one model field of many

Time:12-29

models.py

from django.db import models

class items(models.Model):
    price = models.IntegerField(),
    name = models.TextField(max_length=100),
    category = models.CharField(max_length=100)

When i try to insert a data on admin page it is showing only category field and I'm can fill only this one field.

Also it is showing an extra s in table names for no reason.

I am expecting that there should be 3 columns to fill data: name, price and category but getting only one of them.

https://img.codepudding.com/202212/4c14a5c3b9fe4ac1a58c6085e48f0bdb.png

CodePudding user response:

No comma needed, try this:

from django.db import models

# Create your models here.
class items(models.Model):
    price = models.IntegerField()
    name = models.TextField(max_length=100)
    category = models.CharField(max_length=100)

And do not foget to make migrations:

python3 manage.py makemigrations
python3 manage.py migrate
  • Related