Skip to content

Commit 49f81df

Browse files
committed
no minmax year
1 parent 4518d71 commit 49f81df

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

apps/sponsors/manage/forms.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,9 @@
2525
TieredBenefitConfiguration,
2626
)
2727

28-
MIN_YEAR = 2022
29-
MAX_YEAR = 2050
30-
3128

3229
def year_choices():
33-
"""Return year choices for select widgets."""
30+
"""Return year choices for select widgets. Current year + 2 years forward, plus historical years with data."""
3431
current = timezone.now().year
3532
return [(y, str(y)) for y in range(current + 2, 2021, -1)]
3633

@@ -177,8 +174,9 @@ def __init__(self, *args, **kwargs):
177174
def clean_target_year(self):
178175
"""Validate target year is in acceptable range."""
179176
year = self.cleaned_data["target_year"]
180-
if year < MIN_YEAR or year > MAX_YEAR:
181-
msg = f"Year must be between {MIN_YEAR} and {MAX_YEAR}."
177+
current = timezone.now().year
178+
if year < current:
179+
msg = f"Target year must be {current} or later."
182180
raise forms.ValidationError(msg)
183181
return year
184182

0 commit comments

Comments
 (0)