Example #1
0
def showtimes_tv_single_day(request, date):
    channels = get_tv_channels(request)

    past = 'past' in request.GET
    with_rated = 'with_rated' in request.GET

    date = parse_date(request, date)

    films = get_films(date,
                      channels,
                      request.user,
                      without_unmatched=True,
                      past=past,
                      with_rated=with_rated)

    ctx = dict(
        date=date,
        films=films,
    )

    if not 'ajax' in request.GET:
        template = 'showtimes/films_tv_single_day.html'
    else:
        template = 'showtimes/films_tv_single_day_ajax.html'

    return render(request, template, ctx)
Example #2
0
 def get_queryset(self):
     return get_films(self.date,
                      self.channels,
                      self.request.user,
                      past=self.past,
                      with_rated=self.with_rated,
                      order_by=self.order_by)
Example #3
0
def theater(request, id):
    channel = get_object_or_404(Channel, id=id, type=Channel.TYPE_CINEMA)
    channels = [channel]

    city = request.GET.get('city')
    town = city and get_object_or_404(Town, pk=city)

    if town:
        theaters = Channel.objects.in_town(town)
    else:
        theaters = get_theaters(request)

    country_code = channel.town.country.code

    form = SelectTownForm(country_code,
                          True,
                          initial={
                              'city': town and town.pk or '',
                          })

    date = get_date(request)

    past = 'past' in request.GET
    films = get_films(date, channels, request.user, past=past)

    return render(
        request, "showtimes/theater.html", {
            'city_form': form,
            'town': town,
            'theaters': theaters,
            'channel': channel,
            'date': date,
            'films': films,
            'days': get_available_showtime_dates(request),
        })
Example #4
0
def showtimes_tv(request, by_film=True, type=Channel.TYPE_CINEMA):
    today = get_today(request.timezone)

    channels = get_tv_channels(request)

    past = 'past' in request.GET
    with_rated = 'with_rated' in request.GET

    days = []
    all_films = []

    for day in (0, 1, 2):
        date = today + datetime.timedelta(days=day)
        films = get_films(date, channels, request.user, without_unmatched=True, past=past, with_rated=with_rated)[:TV_FILMS_PER_DAY + 1]
        has_more = len(films) > TV_FILMS_PER_DAY
        films = films[:TV_FILMS_PER_DAY]
        if films:
            days.append({'date':date, 'films':films, 'has_more':has_more})
            all_films.extend(films)
            
    
    ctx = dict(
        days=days,
        films=all_films,
    )

    return render(request, "showtimes/films_tv.html", ctx)
Example #5
0
def showtimes_tv(request, by_film=True, type=Channel.TYPE_CINEMA):
    today = get_today(request.timezone)

    channels = get_tv_channels(request)

    past = 'past' in request.GET
    with_rated = 'with_rated' in request.GET

    days = []
    all_films = []

    for day in (0, 1, 2):
        date = today + datetime.timedelta(days=day)
        films = get_films(date,
                          channels,
                          request.user,
                          without_unmatched=True,
                          past=past,
                          with_rated=with_rated)[:TV_FILMS_PER_DAY + 1]
        has_more = len(films) > TV_FILMS_PER_DAY
        films = films[:TV_FILMS_PER_DAY]
        if films:
            days.append({'date': date, 'films': films, 'has_more': has_more})
            all_films.extend(films)

    ctx = dict(
        days=days,
        films=all_films,
    )

    return render(request, "showtimes/films_tv.html", ctx)
Example #6
0
def theater(request, id):
    channel = get_object_or_404(Channel, id=id, type=Channel.TYPE_CINEMA)
    channels = [channel]

    city = request.GET.get('city')
    town = city and get_object_or_404(Town, pk=city)
    
    if town:
        theaters = Channel.objects.in_town(town)
    else:
        theaters = get_theaters(request)

    country_code = channel.town.country.code
    
    form = SelectTownForm(country_code, True, initial={
        'city':town and town.pk or '',
    })

    date = get_date(request)

    past = 'past' in request.GET
    films = get_films(date, channels, request.user, past=past)

    return render(request, "showtimes/theater.html", {
        'city_form':form,
        'town':town,
        'theaters':theaters,
        'channel':channel,
        'date':date,
        'films': films,
        'days':get_available_showtime_dates(request),
    })
Example #7
0
def theater(request, id):
    channel = get_object_or_404(Channel, id=id)
    channels = [channel]

    city = request.GET.get("city")
    town = city and get_object_or_404(Town, pk=city)

    if town:
        theaters = Channel.objects.in_town(town)
    else:
        theaters = get_theaters(request)

    country_code = channel.town.country.code

    form = SelectTownForm(country_code, True, initial={"city": town and town.pk or ""})

    date = get_date(request)

    past = "past" in request.GET
    films = get_films(date, channels, request.user, past=past)

    return render(
        request,
        "showtimes/theater.html",
        {
            "city_form": form,
            "town": town,
            "theaters": theaters,
            "channel": channel,
            "date": date,
            "films": films,
            "days": get_available_showtime_dates(request),
        },
    )
Example #8
0
 def get_queryset(self):
     return get_films(
         self.date,
         self.channels,
         self.request.user,
         past=self.past,
         with_rated=self.with_rated,
         order_by=self.order_by,
     )
Example #9
0
def tvchannel(request, id):
    channel = get_object_or_404(Channel, pk=id)
    channels = [channel]

    date = get_date(request)
    past = "past" in request.GET
    films = get_films(date, channels, request.user, past=past, without_unmatched=True)
    ctx = dict(channel=channel, date=date, days=get_available_showtime_dates(request), films=films)
    return render(request, "showtimes/single_channel.html", ctx)
Example #10
0
def tvchannel(request, id):
    channel = get_object_or_404(Channel, pk=id)
    if channel.type == Channel.TYPE_CINEMA:
        return HttpResponseRedirect(abs_reverse(theater, args=[id]))
    assert channel.type == Channel.TYPE_TV_CHANNEL
    channels = [channel]

    date = get_date(request)
    past = 'past' in request.GET
    films = get_films(date, channels, request.user, past=past, without_unmatched=True)
    ctx = dict(
        channel=channel,
        date=date,
        days=get_available_showtime_dates(request),
        films=films,
    )
    return render(request, "showtimes/single_channel.html", ctx)
Example #11
0
def showtimes_tv_single_day(request, date):
    channels = get_tv_channels(request)

    past = "past" in request.GET
    with_rated = "with_rated" in request.GET

    date = parse_date(request, date)

    films = get_films(date, channels, request.user, without_unmatched=True, past=past, with_rated=with_rated)

    ctx = dict(date=date, films=films)

    if not "ajax" in request.GET:
        template = "showtimes/films_tv_single_day.html"
    else:
        template = "showtimes/films_tv_single_day_ajax.html"

    return render(request, template, ctx)
Example #12
0
def tvchannel(request, id):
    channel = get_object_or_404(Channel, pk=id)
    if channel.type == Channel.TYPE_CINEMA:
        return HttpResponseRedirect(abs_reverse(theater, args=[id]))
    assert channel.type == Channel.TYPE_TV_CHANNEL
    channels = [channel]

    date = get_date(request)
    past = 'past' in request.GET
    films = get_films(date,
                      channels,
                      request.user,
                      past=past,
                      without_unmatched=True)
    ctx = dict(
        channel=channel,
        date=date,
        days=get_available_showtime_dates(request),
        films=films,
    )
    return render(request, "showtimes/single_channel.html", ctx)
Example #13
0
def showtimes_tv_single_day(request, date):
    channels = get_tv_channels(request)

    past = 'past' in request.GET
    with_rated = 'with_rated' in request.GET
    
    date = parse_date(request, date)

    films = get_films(date, channels, request.user, without_unmatched=True, past=past, with_rated=with_rated)
    
    ctx = dict(
        date=date,
        films=films,
    )

    if not 'ajax' in request.GET:
        template = 'showtimes/films_tv_single_day.html'
    else:
        template = 'showtimes/films_tv_single_day_ajax.html'

    return render(request, template, ctx)