Skip to content
Advertisement

django migration is not creating all the fields from defined model class into db

Hi i am trying to generate migration but all fields are not getting created into the db. Below is my code.

from django.db import models

class News(models.Model):
    author = models.CharField(max_length = 100),
    content = models.CharField(max_length= 100),
    description = models.TextField(default= "")

    def __str__(self):
        return self.author

    class Meta:
        db_table = "news"


class SportNews(models.Model):
    author = models.CharField(max_length = 100),
    content = models.CharField(max_length = 100),
    description = models.TextField(default = "")

    def __str__(self):
        return self.author

    class Meta:
        db_table = "sports_news"

Advertisement

Answer

You are putting comma after defining each field. Remove them and you are good to go!

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement