kopia lustrzana https://github.com/wagtail/wagtail
Remove pre-Django 4.2 fallback code from JSONField null handling migration
rodzic
4e6eaab241
commit
0cf52a6175
|
@ -1,6 +1,5 @@
|
|||
# Generated by Django 4.2.3 on 2023-07-31 11:00
|
||||
|
||||
from django import VERSION as DJANGO_VERSION
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
@ -8,12 +7,7 @@ def replace_json_null_with_empty_object(apps, schema_editor):
|
|||
ModelLogEntry = apps.get_model("wagtailcore.ModelLogEntry")
|
||||
PageLogEntry = apps.get_model("wagtailcore.PageLogEntry")
|
||||
|
||||
# https://github.com/django/django/pull/16245
|
||||
# The way to express a JSON `null` value was changed in Django 4.2.
|
||||
if DJANGO_VERSION >= (4, 2):
|
||||
null = models.Value(None, models.JSONField())
|
||||
else:
|
||||
null = models.Value("null")
|
||||
null = models.Value(None, models.JSONField())
|
||||
|
||||
ModelLogEntry.objects.filter(data=null).update(data={})
|
||||
PageLogEntry.objects.filter(data=null).update(data={})
|
||||
|
|
Ładowanie…
Reference in New Issue