Hi All,

Simplistically, I have an event type model (for a "school class") with
a date field.

On saving of the first event, I want to add recurring objects.
Specifics for this project are "up to a latest date" (ie, end of term)
and "recur weekly only" (not daily, monthly, yearly, etc - for the
school's weekly timetable)

I have just tried overriding the save method on the object to auto
create these objects.

def save(self):
   super(Event, self).save()

   last_date = self.term.end_date
   series_date = self.date + datetime.timedelta(7)
   while series_date < last_date:
      super(Session, self).save(date = series_date)

I've realised that this will most probably not make new objects, but
will only update the date on the current object. Quite separately, I'm
also getting keyword argument error on "date".

How would you go about creating a series of events from a single save
press? Should I be using some sort of external system (celery or ???)
or should I write an additional method for the model that does the
auto-creation?

At some point after working this out, I will have a need to delete the
series as well...and I don't even want to think about editing the
series. Let's start with creating a recurring event and I'll work on
that later.

Cheers
L.




-- 
...we look at the present day through a rear-view mirror. This is
something Marshall McLuhan said back in the Sixties, when the world
was in the grip of authentic-seeming future narratives. He said, “We
look at the present through a rear-view mirror. We march backwards
into the future.”

http://www.warrenellis.com/?p=14314

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to