mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
#17761: Set null=True on Site.time_zone
This commit is contained in:
parent
b841875f63
commit
d093b21bc0
@ -1,3 +1,4 @@
|
|||||||
|
import timezone_field.fields
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
@ -24,6 +25,7 @@ def set_null_values(apps, schema_editor):
|
|||||||
Rack = apps.get_model('dcim', 'Rack')
|
Rack = apps.get_model('dcim', 'Rack')
|
||||||
RackType = apps.get_model('dcim', 'RackType')
|
RackType = apps.get_model('dcim', 'RackType')
|
||||||
RearPort = apps.get_model('dcim', 'RearPort')
|
RearPort = apps.get_model('dcim', 'RearPort')
|
||||||
|
Site = apps.get_model('dcim', 'Site')
|
||||||
|
|
||||||
Cable.objects.filter(length_unit='').update(length_unit=None)
|
Cable.objects.filter(length_unit='').update(length_unit=None)
|
||||||
Cable.objects.filter(type='').update(type=None)
|
Cable.objects.filter(type='').update(type=None)
|
||||||
@ -66,6 +68,7 @@ def set_null_values(apps, schema_editor):
|
|||||||
RackType.objects.filter(outer_unit='').update(outer_unit=None)
|
RackType.objects.filter(outer_unit='').update(outer_unit=None)
|
||||||
RackType.objects.filter(weight_unit='').update(weight_unit=None)
|
RackType.objects.filter(weight_unit='').update(weight_unit=None)
|
||||||
RearPort.objects.filter(cable_end='').update(cable_end=None)
|
RearPort.objects.filter(cable_end='').update(cable_end=None)
|
||||||
|
Site.objects.filter(time_zone='').update(time_zone=None)
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
@ -279,5 +282,10 @@ class Migration(migrations.Migration):
|
|||||||
name='cable_end',
|
name='cable_end',
|
||||||
field=models.CharField(blank=True, max_length=1, null=True),
|
field=models.CharField(blank=True, max_length=1, null=True),
|
||||||
),
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='site',
|
||||||
|
name='time_zone',
|
||||||
|
field=timezone_field.fields.TimeZoneField(blank=True, null=True),
|
||||||
|
),
|
||||||
migrations.RunPython(code=set_null_values, reverse_code=migrations.RunPython.noop),
|
migrations.RunPython(code=set_null_values, reverse_code=migrations.RunPython.noop),
|
||||||
]
|
]
|
||||||
|
@ -189,7 +189,8 @@ class Site(ContactsMixin, ImageAttachmentsMixin, PrimaryModel):
|
|||||||
blank=True
|
blank=True
|
||||||
)
|
)
|
||||||
time_zone = TimeZoneField(
|
time_zone = TimeZoneField(
|
||||||
blank=True
|
blank=True,
|
||||||
|
null=True
|
||||||
)
|
)
|
||||||
physical_address = models.CharField(
|
physical_address = models.CharField(
|
||||||
verbose_name=_('physical address'),
|
verbose_name=_('physical address'),
|
||||||
|
Loading…
Reference in New Issue
Block a user