fix: add o2o field does not create constraint when migrating (#396)
* fix: add o2o field does not create constraint when migrating * Add testcase and update changelog * docs: update migrating list * refactor: use `_handle_o2o_fields` instead of `is_o2o=True` * Remove unused line
This commit is contained in:
@@ -40,6 +40,7 @@ class Email(Model):
|
||||
is_primary = fields.BooleanField(default=False)
|
||||
address = fields.CharField(max_length=200)
|
||||
users: fields.ManyToManyRelation[User] = fields.ManyToManyField("models.User")
|
||||
config: fields.OneToOneRelation["Config"] = fields.OneToOneField("models.Config")
|
||||
|
||||
|
||||
def default_name():
|
||||
@@ -91,6 +92,8 @@ class Config(Model):
|
||||
"models.User", description="User"
|
||||
)
|
||||
|
||||
email: fields.OneToOneRelation["Email"]
|
||||
|
||||
|
||||
class NewModel(Model):
|
||||
name = fields.CharField(max_length=50)
|
||||
|
||||
Reference in New Issue
Block a user