コード例 #1
0
ファイル: views.py プロジェクト: KnightBloodZero/LR-Tour
def vistaAdministrarSugerencias(request):
    if 'botonDeSugerencia' in request.POST:
            valor = request.POST['botonDeSugerencia']
            opcionSeleccionada = SugerenciaLugar.objects.get(id=valor)
            return render(request, 'BaseSugerenciasLugar.html', {'form': opcionSeleccionada})
    controlador = controladorVistaSugerencias()
    ListaDeSugerencias = controlador.mostrarSugerencias()
    return render(request, 'VistaAdministrarSugerencias.html', {'ListaDeSugerencias': ListaDeSugerencias})
コード例 #2
0
ファイル: views.py プロジェクト: KnightBloodZero/LR-Tour
def sugerirNuevoLugar(request):
    if request.method == 'POST':
        form = SugerenciaLugar(request.POST)
        if form.is_valid():
            nombre = form.cleaned_data['nombreDelLugar']
            region = form.cleaned_data['region']
            ciudad = form.cleaned_data['ciudad']
            comuna = form.cleaned_data['comuna']
            imagenDelLugar = form.cleaned_data['imagenDelLugar']
            razonDeVisita = form.cleaned_data['razonDeVisita']
            controlador = controladorVistaSugerencias()
            controlador.crearSugerencia(nombre,region,ciudad,comuna,imagenDelLugar,razonDeVisita)
            return HttpResponseRedirect('/')

    else:
        form = SugerenciaLugar()

    return render(request, 'SugerirLugar.html', {'form': form})