Beispiel #1
0
def find_by_user(user, academic_yr=None):
    """
    :param user: User from which we get the offerYears.
    :param academic_yr: The academic year (takes the current academic year by default).
    :return: All OfferYears where the user is a program manager for a given year.
    """
    if not academic_yr:
        academic_yr = academic_year.current_academic_year()
    program_manager_queryset = program_manager.find_by_user(user, academic_year=academic_yr)
    offer_year_ids = program_manager_queryset.values_list('offer_year', flat=True).distinct('offer_year')
    return OfferYear.objects.filter(pk__in=offer_year_ids).order_by('acronym')
Beispiel #2
0
def find_by_user(user, academic_yr=None):
    """
    :param user: User from which we get the offerYears.
    :param academic_yr: The academic year (takes the current academic year by default).
    :return: All OfferYears where the user is a program manager for a given year.
    """
    if not academic_yr:
        academic_yr = academic_year.current_academic_year()
    program_manager_queryset = program_manager.find_by_user(user, academic_year=academic_yr)
    offer_year_ids = program_manager_queryset.values_list('offer_year', flat=True).distinct('offer_year')
    return OfferYear.objects.filter(pk__in=offer_year_ids).order_by('acronym')