plain.models 0.45.0__py3-none-any.whl → 0.46.1__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 CHANGED
@@ -1,5 +1,28 @@
1
1
  # plain-models changelog
2
2
 
3
+ ## [0.46.1](https://github.com/dropseed/plain/releases/plain-models@0.46.1) (2025-09-25)
4
+
5
+ ### What's changed
6
+
7
+ - Fixed `prefetch_related` for reverse foreign key relationships by correctly handling related managers in the prefetch query process ([2c04e80](https://github.com/dropseed/plain/commit/2c04e80dcd))
8
+
9
+ ### Upgrade instructions
10
+
11
+ - No changes required
12
+
13
+ ## [0.46.0](https://github.com/dropseed/plain/releases/plain-models@0.46.0) (2025-09-25)
14
+
15
+ ### What's changed
16
+
17
+ - 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))
18
+ - 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))
19
+ - Removed deprecated field types: `CommaSeparatedIntegerField`, `IPAddressField`, and `NullBooleanField` ([345295dc](https://github.com/dropseed/plain/commit/345295dc8a))
20
+ - Removed `system_check_deprecated_details` and `system_check_removed_details` from fields ([e3a7d2dd](https://github.com/dropseed/plain/commit/e3a7d2dd10))
21
+
22
+ ### Upgrade instructions
23
+
24
+ - Remove any usage of the deprecated field types `CommaSeparatedIntegerField`, `IPAddressField`, and `NullBooleanField` - use `CharField`, `GenericIPAddressField`, and `BooleanField(null=True)` respectively
25
+
3
26
  ## [0.45.0](https://github.com/dropseed/plain/releases/plain-models@0.45.0) (2025-09-21)
4
27
 
5
28
  ### What's changed
@@ -4,7 +4,7 @@ class BaseDatabaseValidation:
4
4
  def __init__(self, connection):
5
5
  self.connection = connection
6
6
 
7
- def check(self, **kwargs):
7
+ def preflight(self):
8
8
  return []
9
9
 
10
10
  def check_field(self, field, **kwargs):
@@ -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 check(self, **kwargs):
7
- issues = super().check(**kwargs)
8
- issues.extend(self._check_sql_mode(**kwargs))
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, **kwargs):
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.Warning(
17
- f"{self.connection.display_name} Strict Mode is not set for the database connection",
18
- hint=(
19
- f"{self.connection.display_name}'s Strict Mode fixes many data integrity problems in "
20
- f"{self.connection.display_name}, such as data truncation upon insertion, by "
21
- "escalating warnings into errors. It is strongly "
22
- "recommended you activate it.",
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.Warning(
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.W003",
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 in ("IPAddressField", "GenericIPAddressField"):
167
+ if internal_type == "GenericIPAddressField":
169
168
  lookup = "HOST(%s)"
170
169
  else:
171
170
  lookup = "%s::text"
@@ -74,7 +74,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
74
74
  "FloatField": "real",
75
75
  "IntegerField": "integer",
76
76
  "BigIntegerField": "bigint",
77
- "IPAddressField": "char(15)",
78
77
  "GenericIPAddressField": "char(39)",
79
78
  "JSONField": "text",
80
79
  "PositiveBigIntegerField": "bigint unsigned",