Skip to content

Commit 7a99f12

Browse files
committed
Simplify EDTFField init; add direct_input_field to deconstruct()
1 parent b3205af commit 7a99f12

1 file changed

Lines changed: 9 additions & 16 deletions

File tree

edtf/fields.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,12 @@ def __init__(
4848
**kwargs,
4949
):
5050
kwargs["max_length"] = 2000
51-
(
52-
self.natural_text_field,
53-
self.direct_input_field,
54-
self.lower_strict_field,
55-
self.upper_strict_field,
56-
self.lower_fuzzy_field,
57-
self.upper_fuzzy_field,
58-
) = (
59-
natural_text_field,
60-
direct_input_field,
61-
lower_strict_field,
62-
upper_strict_field,
63-
lower_fuzzy_field,
64-
upper_fuzzy_field,
65-
)
51+
self.natural_text_field = natural_text_field
52+
self.direct_input_field = direct_input_field
53+
self.lower_strict_field = lower_strict_field
54+
self.upper_strict_field = upper_strict_field
55+
self.lower_fuzzy_field = lower_fuzzy_field
56+
self.upper_fuzzy_field = upper_fuzzy_field
6657
super().__init__(verbose_name, name, **kwargs)
6758

6859
description = (
@@ -74,6 +65,8 @@ def deconstruct(self):
7465
name, path, args, kwargs = super().deconstruct()
7566
if self.natural_text_field:
7667
kwargs["natural_text_field"] = self.natural_text_field
68+
if self.direct_input_field:
69+
kwargs["direct_input_field"] = self.direct_input_field
7770

7871
for attr in DATE_ATTRS:
7972
field = f"{attr}_field"
@@ -152,7 +145,7 @@ def update_values(self, instance, *args, **kwargs):
152145
):
153146
edtf = parse_edtf(
154147
edtf_string, fail_silently=True
155-
) # potetial ParseException if invalid; should this be raised?
148+
) # potential ParseException if invalid; should this be raised?
156149
else:
157150
edtf = existing_value
158151
else:

0 commit comments

Comments
 (0)