Created
August 20, 2011 18:44
-
-
Save pifantastic/1159479 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Appointment(models.Model): | |
# ... # | |
def save(self, *args, **kwargs): | |
update_series = kwargs.pop('update_series', True) | |
super(Appointment, self).save(*args, **kwargs) | |
if update_series and self.rrule: | |
rrule = self.rrule.get_rrule() | |
for date in rrule.between(self.start_time, self.start_time + timedelta(days=365 * 2)): | |
appt = Appointment() | |
appt.start_time = date | |
appt.rrule = self.rrule | |
appt.save(update_series=False) | |
appt.services = self.services.all() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment