Changeset fa825da in tailbone


Ignore:
Timestamp:
07/10/19 22:58:05 (7 months ago)
Author:
Lance Edgar <ledgar@…>
Branches:
master
Children:
8c2287a
Parents:
839f6af
Message:

Include employee history data in context for "view profile"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tailbone/views/people.py

    r839f6af rfa825da  
    248248            'employee': employee,
    249249            'employee_history': employee.get_current_history() if employee else None,
     250            'employee_history_data': [],
    250251        }
     252
     253        # employee_history_data
     254        if employee:
     255            data = []
     256            for history in sorted(employee.history, key=lambda h: h.start_date, reverse=True):
     257                data.append({
     258                    'start_date': six.text_type(history.start_date),
     259                    'end_date': six.text_type(history.end_date or ''),
     260                })
     261            context['employee_history_data'] = data
     262
    251263        use_buefy = self.get_use_buefy()
    252264        template = 'view_profile_buefy' if use_buefy else 'view_profile'
Note: See TracChangeset for help on using the changeset viewer.