Пример #1
0
 def handle(self, data, user=None, emp=None):
     "Handle submission of releases form"
     validated = self.validators(data)
     if validated:
         #reportsto = User.objects.get(id=data['reportsto'])
         birthdate = data['birthdate']
         hiredate = data['hiredate']
         if emp:
             emp.firstname = data['firstname']
             emp.lastname = data['lastname']
             emp.tshirtsize = data['tshirtsize']
             emp.birthdate = birthdate
             emp.hiredate = hiredate
             emp.emergencycontactno = data['emergencycontactno']
             emp.extension = data['extension']
             emp.email = data['email']
             emp.notes = data['notes']
             #                emp.reportsto = reportsto
             emp.food_preferance = data['food_preferance']
             emp.home_location = data['home_location']
         else:
             emp = Employees(
                 user=user,
                 firstname=data['firstname'],
                 lastname=data['lastname'],
                 tshirtsize=data['tshirtsize'],
                 birthdate=birthdate,
                 hiredate=hiredate,
                 emergencycontactno=data['emergencycontactno'],
                 extension=data['extension'],
                 email=data['email'],
                 notes=data['notes'],
                 #                                reportsto=reportsto,
                 food_preferance=data['food_preferance'],
                 home_location=data['home_location'])
         emp.save()
         return True
     return False