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 django.db import models
from timezone_field import TimeZoneField
EXEMPT_ATTRS = [ SKIP_FIELDS = (
TimeZoneField,
)
EXEMPT_ATTRS = (
'choices', 'choices',
'help_text', 'help_text',
'verbose_name', 'verbose_name',
] )
_deconstruct = models.Field.deconstruct _deconstruct = models.Field.deconstruct
@ -17,12 +22,8 @@ def custom_deconstruct(field):
name, path, args, kwargs = _deconstruct(field) name, path, args, kwargs = _deconstruct(field)
# Remove any ignored attributes # Remove any ignored attributes
for attr in EXEMPT_ATTRS: if field.__class__ not in SKIP_FIELDS:
kwargs.pop(attr, None) 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
return name, path, args, kwargs return name, path, args, kwargs

View File

@ -10,7 +10,7 @@ django-redis==5.0.0
django-rq==2.4.1 django-rq==2.4.1
django-tables2==2.4.0 django-tables2==2.4.0
django-taggit==1.5.1 django-taggit==1.5.1
django-timezone-field==4.1.2 django-timezone-field==4.2.1
djangorestframework==3.12.4 djangorestframework==3.12.4
drf-yasg[validation]==1.20.0 drf-yasg[validation]==1.20.0
graphene_django==2.15.0 graphene_django==2.15.0