-
urls
urlpatterns = [
path(‘admin/’, admin.site.urls),
path(‘mascota/’, include(‘Refugio.mascota.urls’)),
path(‘adopcion/’, include(‘Refugio.adopcion.urls’)),
] -
urls mascota
urlpatterns = [
path(‘’, index),
path(‘crear/’, Mascota_View, name=‘mascota_creada’),
]
on View
def Mascota_View(request):
if request.method == ‘POST’:
form = MascotaForm(request.POST)
if form.is_valid():
form.save()
return redirect(‘index’)
else:
form = MascotaForm()
return render(request, ‘mascota/mascota_form.html’, {‘form’: request(form)})
the Message is:
ValueError at /mascota/crear/
The view Refugio.mascota.views.Mascota_View didn’t return an HttpResponse object. It returned None instead.
Request Method: | GET |
---|---|
Request URL: | http://127.0.0.1:8000/mascota/crear/ |
Django Version: | 4.0.6 |
Exception Type: | ValueError |