def METHOD_NAME(self, department_ids):
    from zou.app.models.department import Department
    self.departments = []
    for department_id in department_ids:
        department = Department.get(department_id)
        if department is not None:
            self.departments.append(department)
    self.save()