I am using the command python manage.py makemigrations
However, I get this error:
You are trying to add a non-nullable field 'id' to contact_info without a default; we can't do that (the database needs something to populate existing rows). Please select a fix: 1) Provide a one-off default now (will be set on all existing rows) 2) Quit, and let me add a default in models.py
Here is models.py:
class Posts(models.Model):
id = models.AutoField(primary_key=True)
post_uesr = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True,related_name='create_user')
post_title = models.CharField(max_length=200)
post_description = models.TextField(max_length=800, null=True, blank=True)
post_likes = models.IntegerField(default=0)
post_date = models.DateTimeField(default=datetime.now)
def __str__(self):
return f'{self.post_uesr}'