예제 #1
0
 def save(self, force_insert=False, force_update=False):
     new_task = True
     super(PostEater, self).save(force_insert, force_update)
     end = self.startDateTime + timedelta(minutes=1)
     color = '#A41515'
     description = "http://127.0.0.1:8000/posts/" + str(
         self.submit_time.strftime("%Y/%b/%d"))
     user_short = self.user.profile.housename
     if new_task:
         event = Event(start=self.startDateTime,
                       end=end,
                       title=user_short,
                       description=description,
                       calendar_id=1)
         event.save()
         rel = EventRelation.objects.create_relation(event, self)
         rel.save()
         try:
             cal = Calendar.objects.get(name="hooggeacht")
         except Calendar.DoesNotExist:
             cal = Calendar(name="bla")
             cal.save()
         cal.events.add(event)
     else:
         event = Event.objects.get_for_object(self)[0]
         event.start = self.startDateTime
         event.end = end
         event.title = title
         event.description = self.description
         event.eventColor = self.color
         event.save()
예제 #2
0
 def save(self, force_insert=False, force_update=False):
     new_meeting = False
     if not self.id:
         new_meeting = True
     unique_slugify(self, 
         "-".join([self.circle.short_name, 
         self.name,
         self.date_and_time.strftime('%Y-%m-%d')])
         )
     super(Meeting, self).save(force_insert, force_update)
     end = self.date_and_time + timedelta(minutes=self.duration)
     title = " ".join([self.circle.short_name, self.get_name_display()])
     if new_meeting:            
         event = Event(
                       start=self.date_and_time, 
                       end=end, 
                       title=title,
                       household_location=self.household_location,
                       alternate_location=self.alternate_location,
                       description=self.description)
         event.save()
         rel = EventRelation.objects.create_relation(event, self)
         rel.save()
         try:
             cal = Calendar.objects.get(pk=1)
         except Calendar.DoesNotExist:
             cal = Calendar(name="Community Calendar")
             cal.save()
         cal.events.add(event)
     else:
         event = Event.objects.get_for_object(self)[0]
         event.start = self.date_and_time
         event.end = end
         event.title = title
         event.household_location = self.household_location
         event.alternate_location = self.alternate_location
         event.description = self.description
         event.save()
예제 #3
0
 def save(self, force_insert=False, force_update=False):
     new_meeting = False
     if not self.id:
         new_meeting = True
     unique_slugify(
         self, "-".join([
             self.circle.short_name, self.name,
             self.date_and_time.strftime('%Y-%m-%d')
         ]))
     super(Meeting, self).save(force_insert, force_update)
     end = self.date_and_time + timedelta(minutes=self.duration)
     title = " ".join([self.circle.short_name, self.get_name_display()])
     if new_meeting:
         event = Event(start=self.date_and_time,
                       end=end,
                       title=title,
                       household_location=self.household_location,
                       alternate_location=self.alternate_location,
                       description=self.description)
         event.save()
         rel = EventRelation.objects.create_relation(event, self)
         rel.save()
         try:
             cal = Calendar.objects.get(pk=1)
         except Calendar.DoesNotExist:
             cal = Calendar(name="Community Calendar")
             cal.save()
         cal.events.add(event)
     else:
         event = Event.objects.get_for_object(self)[0]
         event.start = self.date_and_time
         event.end = end
         event.title = title
         event.household_location = self.household_location
         event.alternate_location = self.alternate_location
         event.description = self.description
         event.save()