Beispiel #1
0
def signup(request, *args, **kwargs):
    place = url_to_place(*args, **kwargs)
    manager = get_schema_manager(request)
    if isinstance(place, Block):
        FormClass, type_code = BlockAlertForm, 'b'
    else:
        FormClass, type_code = LocationAlertForm, 'l'
    email_required = request.user.is_anonymous()
    if request.method == 'POST':
        form = FormClass(request.POST, email_required=email_required, request=request)
        if form.is_valid():
            return finish_signup(request, place, form.cleaned_data)
    else:
        schema_list = manager.filter(is_special_report=False).order_by('plural_name')
        schema_ids = [s.id for s in schema_list]
        form = FormClass(
            initial={
                'email': 'Enter your e-mail address',
                'radius': block_radius_value(request)[1],
                'frequency': '1',
                'include_new_schemas': True,
                'selected_schemas': schema_ids,
                'displayed_schemas': schema_ids,
                },
            email_required=email_required,
            request=request)
    context = get_place_info_for_request(request, *args, **kwargs)
    context['map_configuration'] = _preconfigured_map(context);
    context['form'] = form
    #context['schema_list'] = schema_list
    return eb_render(request, 'alerts/signup_form.html', context)
Beispiel #2
0
def place_kml(request, *args, **kwargs):
    place = url_to_place(*args, **kwargs)
    return render_to_kml('place.kml', {'place': place})