The same Aplication and Database. Makemigration and Migrate applied. On Local Server it works. On eu.pythonanywhere. com with Haggis and Python 3.11, it works. But on pythonanywhere.com with Haggis and Python 3.7, data is not saved.
The HTML is the same.
I couldn't find the error.
def feriados(request):
folgas = FeriadosForm(request.POST or None)
Feriados.objects.filter(data__lt = date.today()).delete()
folgasX = Feriados.objects.all()
v_data = ""
if request.method == 'POST':
v_data = datetime.strptime(request.POST['data'], '%Y-%m-%d').date()
if folgas.is_valid() and v_data >= date.today():
try:
folgas.save()
except Exception as e:
print(f"Error saving data: {e}")
return redirect('z_feriados')
return render(request, "feriados.html", {'folgasX': folgasX})