Include employee history data in context for "view profile"
This commit is contained in:
parent
839f6affe2
commit
fa825da404
|
@ -247,7 +247,19 @@ class PeopleView(MasterView):
|
||||||
'instance_title': self.get_instance_title(person),
|
'instance_title': self.get_instance_title(person),
|
||||||
'employee': employee,
|
'employee': employee,
|
||||||
'employee_history': employee.get_current_history() if employee else None,
|
'employee_history': employee.get_current_history() if employee else None,
|
||||||
|
'employee_history_data': [],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# employee_history_data
|
||||||
|
if employee:
|
||||||
|
data = []
|
||||||
|
for history in sorted(employee.history, key=lambda h: h.start_date, reverse=True):
|
||||||
|
data.append({
|
||||||
|
'start_date': six.text_type(history.start_date),
|
||||||
|
'end_date': six.text_type(history.end_date or ''),
|
||||||
|
})
|
||||||
|
context['employee_history_data'] = data
|
||||||
|
|
||||||
use_buefy = self.get_use_buefy()
|
use_buefy = self.get_use_buefy()
|
||||||
template = 'view_profile_buefy' if use_buefy else 'view_profile'
|
template = 'view_profile_buefy' if use_buefy else 'view_profile'
|
||||||
return self.render_to_response(template, context)
|
return self.render_to_response(template, context)
|
||||||
|
|
Loading…
Reference in a new issue