Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Commit

Permalink
Merge pull request #974 from akatsoulas/fix-alumni-date
Browse files Browse the repository at this point in the history
[bug 1147807] Change the range of years based on the joined program date...
  • Loading branch information
akatsoulas committed Mar 27, 2015
2 parents 88a7013 + fa20b2f commit 33cf492
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions remo/profiles/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@ class Meta:
SelectDateWidget(years=range(2011, now().date().year + 1),
required=False)}

def __init__(self, *args, **kwargs):
super(ChangeDatesForm, self).__init__(*args, **kwargs)

# Set the year portion of the date_left_program field same as the
# date_joined_program field
if self.instance and 'date_left_program' in self.fields:
form_widget = SelectDateWidget(years=range(
self.instance.date_joined_program.year, now().date().year + 1))
self.fields['date_left_program'].widget = form_widget

def save(self, commit=True):
"""Override save method for custom functinality."""

Expand Down

0 comments on commit 33cf492

Please sign in to comment.