Fix KeyError when deleting a field with unqiue=True (#365)

* Fix KeyError when deleting a field with unqiue=True

* refactor: rename `old_data_unique` to `is_unique_field`

* Add testcases for remove unique field

---------

Co-authored-by: gongchangku <gongchangku@anban.tech>
Co-authored-by: Waket Zheng <waketzheng@gmail.com>
This commit is contained in:
gck123
2024-12-03 10:16:44 +08:00
committed by GitHub
parent 103470f4c1
commit c0fd3ec63c
4 changed files with 62 additions and 8 deletions

View File

@@ -51,6 +51,7 @@ class Category(Model):
class Product(Model):
categories: fields.ManyToManyRelation[Category] = fields.ManyToManyField("models.Category")
uid = fields.IntField(source_field="uuid", unique=True)
name = fields.CharField(max_length=50)
view_num = fields.IntField(description="View Num")
sort = fields.IntField()
@@ -64,6 +65,7 @@ class Product(Model):
class Config(Model):
name = fields.CharField(max_length=100, unique=True)
label = fields.CharField(max_length=200)
key = fields.CharField(max_length=20)
value: dict = fields.JSONField()