Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def teaching_events(self, semester):
"""Returns all active affects_teaching events that are in effect during the semester."""
career_events = (CareerEvent.objects.not_deleted()
.overlaps_semester(semester)
.filter(person=self.person)
.filter(flags=CareerEvent.flags.affects_teaching)
.filter(status='A'))
return career_events
def salary_events(self, date, unit=None):
"""Returns all active affects_salary events that are in effect on date."""
career_events = (CareerEvent.objects.not_deleted()
.effective_date(date)
.filter(person=self.person)
.filter(flags=CareerEvent.flags.affects_salary)
.filter(status='A'))
if unit:
career_events = career_events.filter(unit=unit)
return career_events
def summary(request, userid):
"""
Summary page for a faculty member.
"""
person, _ = _get_faculty_or_404(request.units, userid)
editor = get_object_or_404(Person, userid=request.user.username)
career_events = CareerEvent.objects.not_deleted().only_subunits(request.units).filter(person=person)
filterform = EventFilterForm()
context = {
'person': person,
'editor': editor,
'career_events': career_events,
'filterform': filterform,
'can_wizard': not career_events.exclude(event_type='GRANTAPP').exists(),
}
return render(request, 'faculty/summary.html', context)