コード例 #1
0
ファイル: views.py プロジェクト: Alexandrov-Michael/helpdesk
 def form_valid(self, form):
     self.object.user = self.user
     pc      = self.object.pc
     option  = self.object.option
     body    = self.object.body
     user    = self.user
     self.object.date = now()
     new_row = PcOptionListHistory(pc = pc, option=option, body=body, user=user, date=now())
     new_row.save()
     self.set_message(u'Характеристика успешно изменена')
     return super(ChangePcOption, self).form_valid(form)
コード例 #2
0
ファイル: views.py プロジェクト: Alexandrov-Michael/helpdesk
 def form_valid(self, form):
     option  = form.cleaned_data['option']
     body    = form.cleaned_data['body']
     user    = self.user
     new_option = PcOptionsList(
         pc = self.pc,
         option = option,
         body = body,
         user = user,
         date=now(),
     )
     new_option.save()
     new_history_opt = PcOptionListHistory(
         pc = self.pc,
         option = option,
         body = body,
         user = user,
         date=now(),
     )
     new_history_opt.save()
     self.set_message(u'Характеристика успешно добавлена.')
     return super(AddPcOption, self).form_valid(form)