Python Migration

Viewed 27

I have below code in Models.py

from django.db import models

class Post(models.Model):
   text = models.TextField()

I have entered 100 around records to application which run using SQLite DB and Modified it in to following and migrate

from django.db import models

class Post(models.Model):
   title = models.CharField(max_length=200)
   author = models.ForeignKey("auth.User",on_delete=models.CASCADE,)
   text= models.TextField()

When I try to migrate the changes using python manage.py makemigrations I am getting message regarding the 100 records that have null for author. What I need is to modify
above code to set any text without author must be setup as superuser by default.

0 Answers
Related