Skip to content

Commit 0fbcdb0

Browse files
Merge pull request #2 from gabriel-taufer/fix/input_formats-validator
fix: adjust remote form field validation for input_format logic so it does not override the field configuration
2 parents 4dd632d + df88dff commit 0fbcdb0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

django_remote_forms/fields.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ def as_dict(self):
122122
# If initial value is datetime then convert it using first available input format
123123

124124
if (isinstance(field_dict['initial'], (datetime.datetime, datetime.time, datetime.date))):
125-
if not getattr(field_dict['input_formats'], 'len', None):
125+
has_input_formats = len(field_dict.get('input_formats', [])) > 0
126+
if not has_input_formats:
126127
if isinstance(field_dict['initial'], datetime.datetime):
127128
field_dict['input_formats'] = settings.DATETIME_INPUT_FORMATS
128129
elif isinstance(field_dict['initial'], datetime.date):

0 commit comments

Comments
 (0)