plain.models 0.44.0__py3-none-any.whl → 0.46.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- plain/models/CHANGELOG.md +23 -0
- plain/models/backends/base/validation.py +1 -1
- plain/models/backends/mysql/base.py +0 -1
- plain/models/backends/mysql/validation.py +16 -16
- plain/models/backends/postgresql/base.py +0 -1
- plain/models/backends/postgresql/operations.py +1 -2
- plain/models/backends/sqlite3/base.py +7 -2
- plain/models/backends/sqlite3/features.py +1 -0
- plain/models/base.py +206 -234
- plain/models/config.py +1 -9
- plain/models/fields/__init__.py +117 -227
- plain/models/fields/json.py +22 -22
- plain/models/fields/mixins.py +11 -10
- plain/models/fields/related.py +131 -119
- plain/models/migrations/state.py +1 -1
- plain/models/preflight.py +105 -98
- {plain_models-0.44.0.dist-info → plain_models-0.46.0.dist-info}/METADATA +1 -1
- {plain_models-0.44.0.dist-info → plain_models-0.46.0.dist-info}/RECORD +21 -21
- {plain_models-0.44.0.dist-info → plain_models-0.46.0.dist-info}/WHEEL +0 -0
- {plain_models-0.44.0.dist-info → plain_models-0.46.0.dist-info}/entry_points.txt +0 -0
- {plain_models-0.44.0.dist-info → plain_models-0.46.0.dist-info}/licenses/LICENSE +0 -0
plain/models/CHANGELOG.md
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
# plain-models changelog
|
2
2
|
|
3
|
+
## [0.46.0](https://github.com/dropseed/plain/releases/plain-models@0.46.0) (2025-09-25)
|
4
|
+
|
5
|
+
### What's changed
|
6
|
+
|
7
|
+
- The preflight system has been completely reworked with a new `PreflightResult` class that unifies messages and hints into a single `fix` field, providing clearer and more actionable error messages ([b0b610d](https://github.com/dropseed/plain/commit/b0b610d461), [c7cde12](https://github.com/dropseed/plain/commit/c7cde12149))
|
8
|
+
- Preflight check IDs have been renamed to use descriptive names instead of numbers for better clarity (e.g., `models.E003` becomes `models.duplicate_many_to_many_relations`) ([cd96c97](https://github.com/dropseed/plain/commit/cd96c97b25))
|
9
|
+
- Removed deprecated field types: `CommaSeparatedIntegerField`, `IPAddressField`, and `NullBooleanField` ([345295dc](https://github.com/dropseed/plain/commit/345295dc8a))
|
10
|
+
- Removed `system_check_deprecated_details` and `system_check_removed_details` from fields ([e3a7d2dd](https://github.com/dropseed/plain/commit/e3a7d2dd10))
|
11
|
+
|
12
|
+
### Upgrade instructions
|
13
|
+
|
14
|
+
- Remove any usage of the deprecated field types `CommaSeparatedIntegerField`, `IPAddressField`, and `NullBooleanField` - use `CharField`, `GenericIPAddressField`, and `BooleanField(null=True)` respectively
|
15
|
+
|
16
|
+
## [0.45.0](https://github.com/dropseed/plain/releases/plain-models@0.45.0) (2025-09-21)
|
17
|
+
|
18
|
+
### What's changed
|
19
|
+
|
20
|
+
- Added unlimited varchar support to SQLite - CharField fields without a max_length now generate `varchar` columns instead of `varchar()` with no length specified ([c5c0c3a](https://github.com/dropseed/plain/commit/c5c0c3a743))
|
21
|
+
|
22
|
+
### Upgrade instructions
|
23
|
+
|
24
|
+
- No changes required
|
25
|
+
|
3
26
|
## [0.44.0](https://github.com/dropseed/plain/releases/plain-models@0.44.0) (2025-09-19)
|
4
27
|
|
5
28
|
### What's changed
|
@@ -102,7 +102,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
|
102
102
|
"FloatField": "double precision",
|
103
103
|
"IntegerField": "integer",
|
104
104
|
"BigIntegerField": "bigint",
|
105
|
-
"IPAddressField": "char(15)",
|
106
105
|
"GenericIPAddressField": "char(39)",
|
107
106
|
"JSONField": "json",
|
108
107
|
"PositiveBigIntegerField": "bigint UNSIGNED",
|
@@ -3,25 +3,24 @@ from plain.models.backends.base.validation import BaseDatabaseValidation
|
|
3
3
|
|
4
4
|
|
5
5
|
class DatabaseValidation(BaseDatabaseValidation):
|
6
|
-
def
|
7
|
-
issues = super().
|
8
|
-
issues.extend(self._check_sql_mode(
|
6
|
+
def preflight(self):
|
7
|
+
issues = super().preflight()
|
8
|
+
issues.extend(self._check_sql_mode())
|
9
9
|
return issues
|
10
10
|
|
11
|
-
def _check_sql_mode(self
|
11
|
+
def _check_sql_mode(self):
|
12
12
|
if not (
|
13
13
|
self.connection.sql_mode & {"STRICT_TRANS_TABLES", "STRICT_ALL_TABLES"}
|
14
14
|
):
|
15
15
|
return [
|
16
|
-
preflight.
|
17
|
-
f"{self.connection.display_name} Strict Mode is not set for the database connection"
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
id="mysql.W002",
|
16
|
+
preflight.PreflightResult(
|
17
|
+
fix=f"{self.connection.display_name} Strict Mode is not set for the database connection. "
|
18
|
+
f"{self.connection.display_name}'s Strict Mode fixes many data integrity problems in "
|
19
|
+
f"{self.connection.display_name}, such as data truncation upon insertion, by "
|
20
|
+
"escalating warnings into errors. It is strongly "
|
21
|
+
"recommended you activate it.",
|
22
|
+
id="mysql.strict_mode_not_enabled",
|
23
|
+
warning=True,
|
25
24
|
)
|
26
25
|
]
|
27
26
|
return []
|
@@ -40,11 +39,12 @@ class DatabaseValidation(BaseDatabaseValidation):
|
|
40
39
|
and (field.max_length is None or int(field.max_length) > 255)
|
41
40
|
):
|
42
41
|
errors.append(
|
43
|
-
preflight.
|
44
|
-
f"{self.connection.display_name} may not allow unique CharFields to have a max_length "
|
42
|
+
preflight.PreflightResult(
|
43
|
+
fix=f"{self.connection.display_name} may not allow unique CharFields to have a max_length "
|
45
44
|
"> 255.",
|
46
45
|
obj=field,
|
47
|
-
id="mysql.
|
46
|
+
id="mysql.unique_charfield_max_length_too_long",
|
47
|
+
warning=True,
|
48
48
|
)
|
49
49
|
)
|
50
50
|
|
@@ -100,7 +100,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
|
100
100
|
"FloatField": "double precision",
|
101
101
|
"IntegerField": "integer",
|
102
102
|
"BigIntegerField": "bigint",
|
103
|
-
"IPAddressField": "inet",
|
104
103
|
"GenericIPAddressField": "inet",
|
105
104
|
"JSONField": "jsonb",
|
106
105
|
"PositiveBigIntegerField": "bigint",
|
@@ -51,7 +51,6 @@ class DatabaseOperations(BaseDatabaseOperations):
|
|
51
51
|
internal_type = output_field.get_internal_type()
|
52
52
|
if internal_type in (
|
53
53
|
"GenericIPAddressField",
|
54
|
-
"IPAddressField",
|
55
54
|
"TimeField",
|
56
55
|
"UUIDField",
|
57
56
|
):
|
@@ -165,7 +164,7 @@ class DatabaseOperations(BaseDatabaseOperations):
|
|
165
164
|
"regex",
|
166
165
|
"iregex",
|
167
166
|
):
|
168
|
-
if internal_type
|
167
|
+
if internal_type == "GenericIPAddressField":
|
169
168
|
lookup = "HOST(%s)"
|
170
169
|
else:
|
171
170
|
lookup = "%s::text"
|
@@ -39,6 +39,12 @@ def adapt_datetime(val):
|
|
39
39
|
return val.isoformat(" ")
|
40
40
|
|
41
41
|
|
42
|
+
def _get_varchar_column(data):
|
43
|
+
if data["max_length"] is None:
|
44
|
+
return "varchar"
|
45
|
+
return "varchar({max_length})".format(**data)
|
46
|
+
|
47
|
+
|
42
48
|
Database.register_converter("bool", b"1".__eq__)
|
43
49
|
Database.register_converter("date", decoder(parse_date))
|
44
50
|
Database.register_converter("time", decoder(parse_time))
|
@@ -60,7 +66,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
|
60
66
|
"PrimaryKeyField": "integer",
|
61
67
|
"BinaryField": "BLOB",
|
62
68
|
"BooleanField": "bool",
|
63
|
-
"CharField":
|
69
|
+
"CharField": _get_varchar_column,
|
64
70
|
"DateField": "date",
|
65
71
|
"DateTimeField": "datetime",
|
66
72
|
"DecimalField": "decimal",
|
@@ -68,7 +74,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
|
68
74
|
"FloatField": "real",
|
69
75
|
"IntegerField": "integer",
|
70
76
|
"BigIntegerField": "bigint",
|
71
|
-
"IPAddressField": "char(15)",
|
72
77
|
"GenericIPAddressField": "char(39)",
|
73
78
|
"JSONField": "text",
|
74
79
|
"PositiveBigIntegerField": "bigint unsigned",
|
@@ -31,6 +31,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
|
|
31
31
|
supports_json_field_contains = False
|
32
32
|
supports_update_conflicts = Database.sqlite_version_info >= (3, 24, 0)
|
33
33
|
supports_update_conflicts_with_target = supports_update_conflicts
|
34
|
+
supports_unlimited_charfield = True
|
34
35
|
|
35
36
|
@cached_property
|
36
37
|
def supports_atomic_references_rename(self):
|