Exemplo n.º 1
0
def iframe_form(request,
                theme,
                format,
                date=None,
                departure_slug=None,
                departure_zip=None,
                arrival_slug=None,
                arrival_zip=None):
    """Display the content of the Ifram of type "form"/
    
    Checks that the theme and the format matches.
    
    Simple form: departuire, arrival, date (if there is place to display it),
    2 buttons (seeking for conductor or for passenger)

    """
    if theme not in IFRAME_THEMES:
        raise Http404
    if format not in IFRAME_FORMATS:
        raise Http404
    # get date and cities
    departure, arrival = None, None
    if date != '00-00-0000':
        date = get_date(date, FRENCH_DATE_INPUT_FORMATS)
    else:
        date = None
    if departure_slug:
        try:
            departure = City.objects.get_from_slug(departure_slug,
                                                   int(departure_zip))
        except City.DoesNotExist:
            departure = None
    if arrival_slug:
        try:
            arrival = City.objects.get_from_slug(arrival_slug,
                                                 int(arrival_zip))
        except City.DoesNotExist:
            arrival = None
    return home(request,
                layout='iframe',
                theme_id=theme,
                theme_dict=IFRAME_THEMES[theme],
                format_id=format,
                format_dict=IFRAME_FORMATS[format],
                date=date,
                departure=departure,
                arrival=arrival)
Exemplo n.º 2
0
def iframe_form(
    request, theme, format, date=None, departure_slug=None, departure_zip=None, arrival_slug=None, arrival_zip=None
):
    """Display the content of the Ifram of type "form"/
    
    Checks that the theme and the format matches.
    
    Simple form: departuire, arrival, date (if there is place to display it),
    2 buttons (seeking for conductor or for passenger)

    """
    if theme not in IFRAME_THEMES:
        raise Http404
    if format not in IFRAME_FORMATS:
        raise Http404
    # get date and cities
    departure, arrival = None, None
    if date != "00-00-0000":
        date = get_date(date, FRENCH_DATE_INPUT_FORMATS)
    else:
        date = None
    if departure_slug:
        try:
            departure = City.objects.get_from_slug(departure_slug, int(departure_zip))
        except City.DoesNotExist:
            departure = None
    if arrival_slug:
        try:
            arrival = City.objects.get_from_slug(arrival_slug, int(arrival_zip))
        except City.DoesNotExist:
            arrival = None
    return home(
        request,
        layout="iframe",
        theme_id=theme,
        theme_dict=IFRAME_THEMES[theme],
        format_id=format,
        format_dict=IFRAME_FORMATS[format],
        date=date,
        departure=departure,
        arrival=arrival,
    )
Exemplo n.º 3
0
def home_rmll2008(request):
    """special view for RMLL 2008"""
    return home(request, layout="rmll2008")
Exemplo n.º 4
0
def home_rmll2008(request):
    """special view for RMLL 2008"""
    return home(request, layout='rmll2008')