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.
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