1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Bump django-timezone-field to 4.2.1

This commit is contained in:
jeremystretch
2021-08-24 15:52:04 -04:00
parent d11ea67bdd
commit 85b61c0b7e
2 changed files with 11 additions and 10 deletions

View File

@@ -1,11 +1,16 @@
from django.db import models
from timezone_field import TimeZoneField
EXEMPT_ATTRS = [
SKIP_FIELDS = (
TimeZoneField,
)
EXEMPT_ATTRS = (
'choices',
'help_text',
'verbose_name',
]
)
_deconstruct = models.Field.deconstruct
@@ -17,12 +22,8 @@ def custom_deconstruct(field):
name, path, args, kwargs = _deconstruct(field)
# Remove any ignored attributes
for attr in EXEMPT_ATTRS:
kwargs.pop(attr, None)
# A hack to accommodate TimeZoneField, which employs a custom deconstructor to check whether the default choices
# have changed
if hasattr(field, 'CHOICES'):
kwargs['choices'] = field.CHOICES
if field.__class__ not in SKIP_FIELDS:
for attr in EXEMPT_ATTRS:
kwargs.pop(attr, None)
return name, path, args, kwargs