diff options
| author | Emanuel Andrecut <emanuel.andrecut@fleio.com> | 2023-12-13 17:04:06 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-12-14 10:31:36 +0100 |
| commit | 636d701ded62807612df50da37fea3adb88a4bb6 (patch) | |
| tree | 6bccc4ca4898a1d4990ccfbfcfd22b399372bf13 /docs | |
| parent | 8b0710cfc9e845abb2017b007d3dc7aaca3b7979 (diff) | |
[5.0.x] Fixed #35032 -- Corrected Char32UUIDField implementation in 5.0 release notes.
This fixes Char32UUIDField implementation in 5.0 release notes causing
records with UUIDFields created using pre-Django 5.0 and CHAR(32) not
being able to be saved anymore after upgrading and keeping the CHAR(32)
columns.
Regression in 7cd187a5ba58d7769039f487faeb9a5a2ff05540.
Backport of e72b2826ff1eaf2f48ee54a40d2f2988a1fdbb0a from main
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/releases/5.0.txt | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/docs/releases/5.0.txt b/docs/releases/5.0.txt index 4c86337b74..746eaae836 100644 --- a/docs/releases/5.0.txt +++ b/docs/releases/5.0.txt @@ -508,6 +508,12 @@ Django < 5.0 should be replaced with a ``UUIDField`` subclass backed by def db_type(self, connection): return "char(32)" + def get_db_prep_value(self, value, connection, prepared=False): + value = super().get_db_prep_value(value, connection, prepared) + if value is not None: + value = value.hex + return value + For example:: class MyModel(models.Model): @@ -516,8 +522,7 @@ For example:: Should become:: class Char32UUIDField(models.UUIDField): - def db_type(self, connection): - return "char(32)" + ... class MyModel(models.Model): |
