Example #1
0
def event_historic(request, queryset=None, extra_context=None, template_name="event_historic.html"):
    filters = {}
    event_collection = get_collection_event()

    today = datetime.datetime.now()
    filters = Q(end__lte=today)

    context = {"_filters_collection": filters, "_group_by_collection": None, "_order_by_collection": "-end"}
    extra_context = extra_context or {}
    context.update(extra_context)
    return collection_view(request, event_collection, extra_context=context, template_name=template_name)
Example #2
0
def news_by_date(request, year, month, day):
    news_collection = get_collection_news()
    try:
        date = datetime(int(year), int(month), int(day))
    except ValueError:
        raise Http404()
    extra_context = {'_filters_collection': dict(publish_date__year=year,
                                             publish_date__month=month,
                                             publish_date__day=day),
                     'date': date}
    return collection_view(request, news_collection, extra_context=extra_context,
                           template_name='news/news_index.html')
Example #3
0
def event_list(
    request, year=None, month=None, day=None, queryset=None, extra_context=None, template_name="event_list.html"
):
    filters = {}
    date_day_start = None
    event_collection = get_collection_event()

    if year and month and day:
        try:
            date_day_start = datetime.datetime(int(year), int(month), int(day), 0, 0, 0)
            date_day_end = datetime.datetime(int(year), int(month), int(day), 23, 59, 59)
        except ValueError:
            raise Http404
        filters = Q(start__lt=date_day_end, end__gt=date_day_start)
    else:
        today = datetime.datetime.now()
        filters = Q(start__gte=today) | Q(end__gte=today)

    context = {"date": date_day_start, "_filters_collection": filters}
    extra_context = extra_context or {}
    context.update(extra_context)
    return collection_view(request, event_collection, extra_context=context, template_name=template_name)
Example #4
0
def banner_index(request, template_name='banner/banner_index.html'):
    banner_list = get_collection_banner()
    return collection_view(request, banner_list, template_name=template_name)
Example #5
0
def news_index(request, extra_context=None, template_name='news/news_index.html'):
    news_collection = get_collection_news()
    return collection_view(request, news_collection, extra_context=extra_context, template_name=template_name)