-1

enter image description here

I just wanna add other attribute to model

class BookCardsModel(models.Model):
    class Meta:
        verbose_name = 'Card Books'
        verbose_name_plural = 'Card Books'

    book_cover = models.ImageField()
    book_name = models.CharField(max_length=100)
    book_subtitle = models.CharField(max_length=100)
    book_description = models.TextField(max_length=300)
    full_description = models.TextField(max_length=700)
    book_quantity = models.IntegerField(default=0)
    book_color = models.CharField(max_length=100, blank=True)
    book_size = models.CharField(max_length=100, blank=True)
    digital = models.BooleanField(default=False,null=True,blank=False) 
Tim Roberts
  • 48,973
  • 4
  • 21
  • 30

2 Answers2

2

After updating the django models, you'll need to create new migrations and then migrate

you can use following commands

python manage.py makemigrations # to make migrations
python manage.py migrate # to migrate

then your actual DB would be updated and new columns will be added

Ayush Shah
  • 468
  • 4
  • 9
0

You can inspect your recent migration file to check the required columns have applied or not. If yes, Do you make migrations as Ayush's answer.

If problem still persists, Maybe You've messed up your migrations files. You can fake migration

python manage.py migrate --fake appname migration

Be careful while applying --fake or --fake-intial on migrations

You can read in detail here: Reference

If problem still persists, Consider uploading migrations and error logs in question which can used to resolve faster by anyone.

Pradeep
  • 26
  • 1