Esempio n. 1
0
 def new(self, creator, name):
     """
         create a new projects, this add membership and add default sprints  
     """
     from sprints.models import Sprint
     self.name = name
     self.creator = creator
     self.status = 'active'
     #TODO: add feed url
     self.save()
       
     member = Member()
     member.new(creator, self, 'leader')
     
     sprint = Sprint()
     start_date = datetime.datetime.now()
     end_date = start_date + relativedelta(weeks=1)
     sprint.new(self, 'Sprint', start_date, end_date)
         
     try:
         p = get_pusher()
         for member in self.member_set.all():
             p[member.user.username].trigger("project_created", {
                 'project':  {'id': self.id, 'name': self.name}
             })
     except:
         logging.exception("error notifying")
     
     return self
Esempio n. 2
0
 def save(self, *args , ** kwargs ):
     if self.id is None:
         message = 'comment_created'
     else:
         message = 'comment_updated'
         
     super(Comment, self).save(* args, ** kwargs)
         
     try:
         p = get_pusher()
         for member in self.task.project.member_set.all():
             p[member.user.username].trigger(message, {
                 'comment':  {'user': self.user.id, 'comment': self.comment, 'task': self.task.id}
             })
     except:
         logging.exception("error notifying")
Esempio n. 3
0
 def save(self, *args, **kwargs):
     if self.id is None:
         message = 'sprint_created'
     else:
         message = 'sprint_updated'
         
     super(Sprint, self).save(* args, ** kwargs)
         
     try:
         pus = get_pusher()
         for member in self.project.member_set.all():
             pus[member.user.username].trigger(message, {
                 'sprint': {'id': self.id, 'project': self.project.id}
             })
     except:
         logging.exception("error notifying")
Esempio n. 4
0
 def save(self, *args , ** kwargs ):
     if self.id is None:
         message = 'task_created'
     else:
         message = 'task_updated'
         
     super(Task, self).save(* args, ** kwargs)
         
     try:
         p = get_pusher()
         for member in self.project.member_set.all():
             p[member.user.username].trigger(message, {
                 'task':  self.to_python()
             })
     except:
         logging.exception("error notifying")
Esempio n. 5
0
 def save(self, *args, **kwargs):
     if self.id is None:
         message = 'task_created'
     else:
         message = 'task_updated'
     
     #set status to complete when remaining is 0
     if self.remaining and int(self.remaining) == 0:            
         self.status = 'C'
                 
     super(Task, self).save(*args, **kwargs)    
         
     try:
         p = get_pusher()
         for member in self.project.member_set.all():
             p[member.user.username].trigger(message, {
                 'task': self.to_python()
             })
     except:
         logging.exception("error notifying")