Hi i am trying to generate migration but all fields are not getting created into the db. Below is my code.
JavaScript
x
25
25
1
from django.db import models
2
3
class News(models.Model):
4
author = models.CharField(max_length = 100),
5
content = models.CharField(max_length= 100),
6
description = models.TextField(default= "")
7
8
def __str__(self):
9
return self.author
10
11
class Meta:
12
db_table = "news"
13
14
15
class SportNews(models.Model):
16
author = models.CharField(max_length = 100),
17
content = models.CharField(max_length = 100),
18
description = models.TextField(default = "")
19
20
def __str__(self):
21
return self.author
22
23
class Meta:
24
db_table = "sports_news"
25
Advertisement
Answer
You are putting comma after defining each field. Remove them and you are good to go!