I don’t use the Django form, but save data via AJAX. How do I go to another page after saving, for example, ‘home’? It doesn’t work that way…
def JurnalOst(request):
podraz = Podraz.objects.get(pk=74)
postav = Postav.objects.get(pk=9)
obct = Obct.objects.get(pk=180)
fio = Fio.objects.get(pk=5)
jurnalost=Jurnal.objects.filter(oper=1)
if request.method=='POST':
nomerdoc1=request.POST['nomerdoc']
datadoc1=request.POST['datadoc']
print(nomerdoc1,datadoc1)
newost=Jurnal()
newost.nomerdoc=nomerdoc1
newost.datadoc=datadoc1
newost.podraz=podraz
newost.postav=postav
newost.obct=obct
newost.fio=fio
newost.oper=1
newost.save()
un = Jurnal.objects.values()
unit_data=list(un)
#return JsonResponse({'status':1,'unit_data':unit_data})
return reverse('home')
urlpatterns=[
path('', loginUser, name='loginUser'),
path('main/',index,name='home'),
]