Пример #1
0
    def get_queryset(self):
        study_groups = StudyGroup.objects.published()
        if not self.request.user.is_staff:
            team_users = get_team_users(self.request.user)
            study_groups = study_groups.filter(facilitator__in=team_users)

        meetings = Meeting.objects.active().filter(study_group__in=study_groups)
        return meetings
Пример #2
0
def organize(request):
    today = datetime.datetime.now().date()
    two_weeks_ago = today - datetime.timedelta(weeks=2, days=today.weekday())
    two_weeks = today - datetime.timedelta(
        days=today.weekday()) + datetime.timedelta(weeks=3)
    study_groups = StudyGroup.objects.active()
    facilitators = Facilitator.objects.all()
    courses = [
    ]  # TODO Remove courses until we implement course selection for teams
    team = None

    if not request.user.is_staff:
        team = get_user_team(request.user)
        team_users = get_team_users(request.user)
        study_groups = study_groups.filter(facilitator__in=team_users)
        facilitators = facilitators.filter(user__in=team_users)

    active_study_groups = study_groups.filter(
        id__in=StudyGroupMeeting.objects.active().filter(
            meeting_date__gte=two_weeks_ago).values('study_group'))
    meetings = StudyGroupMeeting.objects.active()\
        .filter(study_group__in=study_groups, meeting_date__gte=two_weeks_ago)\
        .exclude(meeting_date__gte=two_weeks)

    context = {
        'team': team,
        'courses': courses,
        'meetings': meetings,
        'study_groups': study_groups,
        'active_study_groups': active_study_groups,
        'facilitators': facilitators,
        'today': timezone.now(),
    }
    return render_to_response('studygroups/organize.html',
                              context,
                              context_instance=RequestContext(request))
Пример #3
0
 def get_queryset(self):
     study_groups = StudyGroup.objects.active()
     if not self.request.user.is_staff:
         team_users = get_team_users(self.request.user)
         study_groups = study_groups.filter(facilitator__in=team_users)
     return study_groups