def populate_reminder(self, reminder):
        # This will bubble up if any problems pop up
        reminder.type = ReminderType.objects.get(key=self.type.data)

        try:
            reminder.valid_until = datetime(month=self.valid_until.month.data,
                                            day=self.valid_until.day.data,
                                            year=self.valid_until.year.data)
        except:
            reminder.valid_until = None

        # Set the notifications
        reminder.send_sms = 'SMS' in self.notifications.data
        reminder.send_email = 'EMAIL' in self.notifications.data

        # Set threshold based on type
        if reminder.type == 'BAL':
            reminder.threshold = float('%.2f' % round(self.balance_threshold.data, 2))
        elif reminder.type == 'RIDE':
            reminder.threshold = self.ride_threshold.data
        elif reminder.type == 'ROUND_TRIP':
            reminder.threshold = self.round_trip_threshold.data
        elif reminder.type == 'EXP':
            reminder.threshold = self.exp_threshold.data
            reminder.quantifier = self.exp_quantity.data

        return reminder
dataset/ETHPy150Open shaunduncan/breezeminder/breezeminder/forms/reminder.py/ReminderForm.populate_reminder/original