コード例 #1
0
ファイル: forms.py プロジェクト: joaquimrocha/Rancho
 def save(self, user, project, message, new=False):
     if new:
         me=Message(
            title   = message.title,
            body    = self.cleaned_data['message'],
            creator  = user,
            project = project,
            initial_message = message,
         )
         me.save()
         return me
     else:
         message.body    = self.cleaned_data['message']
         message.creation_date = datetime.datetime.now()
         message.save()
         return message
コード例 #2
0
 def save(self, user, project, message, new=False):
     if new:
         me = Message(
             title=message.title,
             body=self.cleaned_data['message'],
             creator=user,
             project=project,
             initial_message=message,
         )
         me.save()
         return me
     else:
         message.body = self.cleaned_data['message']
         message.creation_date = datetime.datetime.now()
         message.save()
         return message
コード例 #3
0
 def save(self, user, project, message=None):
     if message:  #update
         message.title = self.cleaned_data['title']
         message.body = self.cleaned_data['message']
         message.tags = self.cleaned_data['tags']
         message.save()
         return message
     else:  #new
         me = Message(
             title=self.cleaned_data['title'],
             body=self.cleaned_data['message'],
             tags=self.cleaned_data['tags'],
             creator=user,
             project=project,
         )
         me.save()
         [me.notify_to.add(user) for user in self.cleaned_data['notify']]
         me.initial_message = me
         me.save()
         me.read_by.add(user)
         return me
コード例 #4
0
ファイル: forms.py プロジェクト: joaquimrocha/Rancho
 def save(self, user, project, message=None):
     if message: #update
         message.title   = self.cleaned_data['title']
         message.body   = self.cleaned_data['message']
         message.tags = self.cleaned_data['tags']
         message.save()
         return message
     else: #new
         me=Message(
             title   = self.cleaned_data['title'],
             body    = self.cleaned_data['message'],
             tags = self.cleaned_data['tags'],
             creator  = user,
             project = project,
         )
         me.save()
         [me.notify_to.add(user) for user in self.cleaned_data['notify']]
         me.initial_message=me
         me.save()
         me.read_by.add(user)
         return me