Django South - Create Not Null ForeignKey

前端 未结 3 1598
抹茶落季
抹茶落季 2021-02-06 16:09

I have a Model

class Mystery(models.Model):
    first = models.CharField(max_length=256)
    second = models.CharField(max_length=256)
    third = models.CharFie         


        
3条回答
  •  时光说笑
    2021-02-06 17:00

    If your database already contains Mystery objects, then south must know, what value put into player field, because it cannot be blank.

    One possible solution:

    choose

        2. Specify a one-off value to use for existing columns now
    

    and then enter 1. So all of your existing Mystery objects will now point to Player with pk = 1. Then you can change (if needed) this in admin page.

提交回复
热议问题