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

Tags: , , ,



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"

Answer

Oh, I find the issue.

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



Source: stackoverflow