Exemple #1
0
def home(request):
    """
    Website homepage (/).
    """

    announcements = Announcement.objects.all().order_by('-publication_date')
    carousel_items = CarouselItem.objects.filter(
        expiration_date__gt=datetime.today).order_by('priority')[:6]

    tooltip.content(request,
        title="""Bienvenue sur la nouvelle version d'<b>eistiens.net</b>""",
        text="""Après des années d'absence, eistiens.net reprend du service en
                tant que portail dédié à la vie étudiante à l'EISTI. Vous
                pouvez désormais consulter <b>eistiens.net</b> pour connaître
                les prochains <b>événements</b> organisés dans l'école ou
                encore découvrir de nouvelles <b>associations</b>""")
    tooltip.icon(request, 'rocket')
    tooltip.button(request, 'En savoir plus', 'portal.views.features')

    return render_to_response(
        "home2.html",
        {
            'request': request,
            'recent_announcements': announcements,
            'carousel_items': carousel_items,
        }, context_instance=RequestContext(request))
Exemple #2
0
def agenda(request):
    """
    Displays a list of upcoming events.

    This views is the homepage of the events module. It shows a list of
    upcoming events, and splits them into three categories : current week
    event, next week, and further events.

    :param request: request object
    """

    today = datetime.today()
    two_weeks_later, _ = get_week_boundaries(2)

    # Querying all upcoming events
    upcoming_events = Event.objects.filter(
        day__gte=datetime.today(), day__lte=two_weeks_later)
    upcoming_events.order_by('day', 'start_time')

    later_events_count = Event.objects.filter(day__gt=two_weeks_later).count()

    tooltip.content(request,
        title="""Planning des événements""",
        text="""Ce serait dommage de passer à côté des activités proposées par
            les associations !""")
    tooltip.icon(request, 'calendar')
    tooltip.button(request,
        text='<i class="fa fa-calendar-o"></i>  Calendrier des événements',
        view='events.views.calendar')

    return render_to_response(
        "agenda2.html",
        {
            'request': request,
            'current_day': today,
            'end_two_week_span': two_weeks_later,
            'event_list': upcoming_events,
            'later_events_count': later_events_count,
        }, context_instance=RequestContext(request))