Ejemplo n.º 1
0
def list_imported_clubs(request):
    clubs = Club.objects.filter(
        original_domain_name='leagueathletics').order_by('name')

    paginator = EntitiesPaginator(clubs, 50)
    current_page = int(request.GET.get('page', 1))
    page = paginator.page(current_page)

    form = LeagueAthleticsImportedClubsSearchForm()
    if request.method == "POST":
        form = LeagueAthleticsImportedClubsSearchForm(request.POST)
        if form.is_valid():
            original_name = request.POST.get('name', None)
            if original_name:
                clubs = clubs.filter(name=original_name)

    paginator = EntitiesPaginator(clubs, 50)
    current_page = int(request.GET.get('page', 1))
    page = paginator.page(current_page)

    return render_to_response(
        'spudderadmin/pages/leagueathletics/list_imported_clubs.html', {
            'clubs': page.object_list,
            'page': page,
            'total_pages': paginator.num_pages,
            'paginator_page': page.number,
            'start': page.start_index(),
            'search_form': form
        })
Ejemplo n.º 2
0
def list_imported_clubs(request):
    clubs = Club.objects.filter(original_domain_name='leagueathletics').order_by('name')

    paginator = EntitiesPaginator(clubs, 50)
    current_page = int(request.GET.get('page', 1))
    page = paginator.page(current_page)

    form = LeagueAthleticsImportedClubsSearchForm()
    if request.method == "POST":
        form = LeagueAthleticsImportedClubsSearchForm(request.POST)
        if form.is_valid():
            original_name = request.POST.get('name', None)
            if original_name:
                clubs = clubs.filter(name=original_name)

    paginator = EntitiesPaginator(clubs, 50)
    current_page = int(request.GET.get('page', 1))
    page = paginator.page(current_page)

    return render_to_response('spudderadmin/pages/leagueathletics/list_imported_clubs.html', {
        'clubs': page.object_list,
        'page': page,
        'total_pages': paginator.num_pages,
        'paginator_page': page.number,
        'start': page.start_index(),
        'search_form': form
    })
Ejemplo n.º 3
0
def associate_with_venue(request, page_id):
    page = get_object_or_404(TeamPage, pk=page_id)
    venues_objects = Venue.objects.filter(sport=page.sport).order_by('name')
    is_associated, associated_venues = _check_if_team_is_associated(page)
    venues = []

    for venue in venues_objects:
        if venue not in associated_venues:
            venues.append(venue)

    # Pagination
    current_page = int(request.GET.get('page', 1))
    venues_paginator = EntitiesPaginator(venues, 20)
    venue_page = venues_paginator.page(current_page)

    role_dashboard = 'spudderspuds/teams/pages/dashboard_pages/dashboard_base.html'
    if request.current_role.entity_type == RoleController.ENTITY_STUDENT:
        role_dashboard = 'spuddercern/pages/dashboard_pages/dashboard.html'
    elif request.current_role.entity_type == RoleController.ENTITY_FAN:
        role_dashboard = 'spudderspuds/fans/pages/dashboard.html'

    return render(
        request, 'components/sharedpages/teams/associate_with_venue.html', {
            'page': page,
            'venues': venue_page.object_list,
            'total_pages': venues_paginator.num_pages,
            'paginator_page': venue_page.number,
            'start': venue_page.start_index(),
            'role_dashboard': role_dashboard,
        })
Ejemplo n.º 4
0
def associate_with_venue(request, page_id):
    page = get_object_or_404(TeamPage, pk=page_id)
    venues_objects = Venue.objects.filter(sport=page.sport).order_by('name')
    is_associated, associated_venues = _check_if_team_is_associated(page)
    venues = []

    for venue in venues_objects:
        if venue not in associated_venues:
            venues.append(venue)


    # Pagination
    current_page = int(request.GET.get('page',1))
    venues_paginator = EntitiesPaginator(venues, 20)
    venue_page = venues_paginator.page(current_page)

    role_dashboard = 'spudderspuds/teams/pages/dashboard_pages/dashboard_base.html'
    if request.current_role.entity_type == RoleController.ENTITY_STUDENT:
        role_dashboard = 'spuddercern/pages/dashboard_pages/dashboard.html'
    elif request.current_role.entity_type == RoleController.ENTITY_FAN:
        role_dashboard = 'spudderspuds/fans/pages/dashboard.html'

    return render(request, 'components/sharedpages/teams/associate_with_venue.html', {
        'page': page,
        'venues': venue_page.object_list,
        'total_pages': venues_paginator.num_pages,
        'paginator_page': venue_page.number,
        'start': venue_page.start_index(),
        'role_dashboard': role_dashboard,
    })