Нет обратного совпадения в /showing файле, я только что получил ошибку этого
Появилась ошибка при выполнении кода.Я хочу перенаправить с помощью кнопки на другую страницу но она показывает мне ошибку я не делал больше кодирования просто простой код который мы используем для этого я написал его не более того NoReverseMatch в /showing Reverse for '<WSGIRequest: GET '/showing'>' не найден. '<WSGIRequest: GET '/showing'>' не является допустимым именем функции представления или шаблона. мой код views.py
from django.shortcuts import redirect, render
from django.contrib.auth import authenticate,login
from user.forms import *
from django.contrib import messages
from user.models import *
from user.models import Orders
# Create your views here.
def home(request):
return render(request,'home.html')
def login(request):
if request.method=='POST':
username=request.POST['username']
password=request.POST['password']
userm=authenticate(user=username,passe=password)
if userm is not None:
login(request,userm)
messages.success(request,"You have login successfully...")
return redirect("home")
else:
messages.error(request,"Invalid Username or password...")
return redirect("login")
else:
return render(request,'base.html')
def register(request):
if request.method=='POST':
fm=Userregistration(request.POST)
if fm.is_valid():
fm.save()
else:
fm=Userregistration()
return render(request,'register.html',{'form':fm})
def Orderreg(request):
if request.method=='POST':
fm=Orderbook(request.POST)
if fm.is_valid():
pi=fm.cleaned_data['parcel_info']
pq=fm.cleaned_data['parcel_qty']
pw=fm.cleaned_data['parcel_weight']
um=fm.cleaned_data['unit_mass']
d=fm.cleaned_data['desti']
ord=Orders(parcel_info=pi,parcel_qty=pq,parcel_weight=pw,unit_mass=um,desti=d)
ord.save()
fm=Orderbook()
return redirect('service')
else:
fm=Orderbook()
u=Orders.objects.all()
return render(request,'service.html',{'form':fm,'us':u})
def contact(request):
return render(request,'contact.html')
def about(request):
return render(request,'about.html')
def show(request):
return redirect(request,'showing.html')
urls.py
from django.urls.conf import path
from user import views
urlpatterns = [
path('',views.home,name='home'),
path('home',views.home,name='home'),
path('login',views.login,name='login'),
path('register',views.register,name='register'),
path('about',views.about,name='about'),
path('service',views.Orderreg,name='service'),
path('contact',views.contact,name='contact'),
path('showing',views.show,name='show'),
]
моя страница show.html пуста код служебного файла.html
{% extends 'base.html' %}
{% block body %}
{% load static %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="stylesheet" href="{% static 'css/bootstrap.css' %}">
</head>
<body>
<form action="" method="POST">
{% csrf_token %}
<section class="" style="background-color: #b6977d;">
<div class="container h-200">
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col-lg-12 col-xl-11">
<div class="card text-black my-5" style="border-radius: 35px;">
<div class="card-body p-md-5">
<div class="row justify-content-center">
<div class="col-md-10 col-lg-6 col-xl-5 order-2 order-lg-1">
<p class="text-center h1 fw-bold mb-5 mx-1 mx-md-4 mt-4">Place order</p>
{{form.as_p}}
<input type="submit" class="btn btn-success btn-block" value="Order">
<a href="showing" class="btn btn-success btn-block">Show my Order</a>
</div>
<div class="col-md-10 col-lg-6 col-xl-7 d-flex align-items-center order-1 order-lg-2">
<img src="/static/user-registration-removebg-preview.png" class="img-fluid" alt="Sample image">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<script src="{% static 'js/jquery.js' %}"></script>
<script src="{% static 'js/poper.js' %}"></script>
<script src="{% static 'js/bootstrap.js' %}"></script>
</body>
</html>
{% endblock body %}
