Answer the question
In order to leave comments, you need to log in
Django migration?
I decided to add a new app to the project. Created a model:
class Comments_appl(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL, default=1)
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey('content_type', 'object_id')
content = models.TextField()
datetime = models.DateTimeField(auto_now_add = True)
def __unicode__(self):
return str(self.user.username)
def __str__(self):
return str(self.user.username)
You are trying to add a non-nullable field 'content_type' to comments_appl 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 with a null value for this column)
2) Quit, and let me add a default in models.py
Select an option:
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question