text: from django.shortcuts import render, redirect
  from django.contrib.auth import authenticate, login
  from .forms import *
  from .filters import VisitaFilter
  
  def index(request):
      filter = VisitaFilter()
      visitas = Visita.objects.all()
  
      context = {
          'visitas': visitas,
          'filter': filter,
      }
      return render(request, 'index.html', context)
  
  def user_login(request):
      if request.method == "POST":
          form = LoginUsuario(request.POST or None)
          if form.is_valid():
              username = form.cleaned_data.get('usuário')
              password = form.cleaned_data.get('senha')
              user = authenticate(request, username=username, password=password)
              if user != None:
                  login(request, user)
                  return redirect('index')
              else:
                  return HttpResponse('ERRO')
      else:
          form = LoginUsuario()
          return render(request, 'login_usuario.html', {'form': form})
  
  def cadastro_usuario(request):
      form = UsuarioForm()
      if request.method == "POST":
          form = UsuarioForm(request.POST or None)
          if form.is_valid():
              form.save()
              return redirect('index')
      return render(request, 'cadastro_usuario.html', {'form': form})
  
  def cadastro_visitante(request):
      form = VisitanteForm()
      if request.method == "POST":
          form = VisitanteForm(request.POST or None)
          if form.is_valid():
              form.save()
              return redirect('index')
      return render(request, 'cadastro_visitante.html', {'form': form})
  
  def cadastro_visita(request):
      form = VisitaForm()
      if request.method == "POST":
          form = VisitaForm(request.POST or None)
          if form.is_valid():
              form.save()
              return redirect('index')
      return render(request, 'cadastro_visita.html', {'form': form})
  
  def usuarios(request):
      return render(request, 'usuarios.html', {})
  
  def visitas(request):
      return render(request, 'visitas.html', {})
  