Performing an application in Django (without using the forms that the framework brings), when accessing to edit a record the url that the browser shows me remains as follows:
Up here all good, but once I edit the record I have the same url. How can I make the url run out of the Id I edited?
URL.py
url(r'^empresa$', empresa, name='empresa'),
url(r'^empresaEditar/(?P<id_empresa>\d+)/$', empresaEditar, name='empresaEditar'),
Views.py
def empresa(request):
return render(request, 'estructuracion/empresa.html')
def empresaEditar(request, id_empresa):
if request.method == 'POST':
.
.
.
msg='Registro modificado exitosamente'
return HttpResponseRedirect('estructuracion/empresa',{'departamentos':departamentos, 'ciudades':ciudades,'msg':msg,})
else:
msg = validator.getMessage()
return HttpResponseRedirect('estructuracion/empresa',{'departamentos':departamentos, 'business':business, 'ciudades':ciudades,'msg':msg,})
return render(request,'estructuracion/empresa.html',{'departamentos':departamentos, 'business':business, 'ciudades':ciudades,})
Another question is:
As you can see I am returning with HttpResponseRedirect
but through this the messages that I sent you do not take me to html.