I am using django for a project and i got this error - django

I am doing a project in Django and i got this error.How is this occurs?
NoReverseMatch at /
Reverse for 'create_order' with no arguments not found. 1 pattern(s) tried: ['create_order/(?P[^/]+)/$']
urls.py
from django.urls import path
from accounts import views
urlpatterns = [
path('',views.home, name="home"),
path('product/',views.products, name="product"),
path('customer/<str:pkid>/',views.customer, name="customer"),
path('create_order/<str:pk>/',views.createOrder, name="create_order"),
path('update_order/<str:pk>/',views.updateOrder, name="update_order"),
path('delete_order/<str:pk>/',views.deleteOrder, name="delete_order"),
]
views.py
def createOrder(request, pk):
customer = Customer.objects.get(id=pk)
form = OrderForm(initial={'customer':customer})
if request.method == 'POST':
form = OrderForm(request.POST)
if form.is_valid:
form.save()
return redirect('/')
context = {'form':form}
return render(request, 'accounts/order_form.html', context)
order_form.html
{% extends 'accounts/main.html' %}
{% load static %}
{% block content %}
<form action="" method="POST">
{% csrf_token %}
{{ form }}
<input type="submit" name="Submit">
</form>
{% endblock %}
customer.html`
{% extends 'accounts/main.html' %}
{% block content %}
<br>
<div class="row" style="margin: auto;">
<div class="col-md">
<div class="card card-body">
<h5>Customer:{{customer.name}}</h5>
<hr>
Update Customer
Place Order
</div>
</div>
<div class="col-md">
<div class="card card-body">
<h5>Contact Information</h5>
<hr>
<p>Email: {{customer.email}}</p>
<p>Phone: {{customer.phone}}</p>
</div>
</div>
<div class="col-md">
<div class="card card-body">
<h5>Total Orders</h5>
<hr>
<h1 style="text-align:center;padding:10px">{{total_orders}}</h1>
</div>
</div>
</div>
<br>
<div class="row" style="margin: auto;">
<div class="col">
<div class="card card-body">
<form method="get">
<button class="btn btn-primary" type="submit">Search</button>
</form>
</div>
</div>
</div>
<br>
<div class="row" style="margin: auto;">
<div class="col-md">
<div class="card card-body">
<table class="table table-sm">
<tr>
<th>Product</th>
<th>Category</th>
<th>Date Ordered</th>
<th>Status</th>
<th>Update</th>
<th>Remove</th>
</tr>
{% for order in orders %}
<tr>
<td>{{order.product.name}}</td>
<td>{{order.product.category}}</td>
<td>{{order.date_created}}</td>
<td>{{order.status}}</td>
<td><a class="btn btn-sm btn-warning" href="{% url 'update_order' order.id %}">Update</a></td>
<td><a class="btn btn-sm btn-danger" href="{% url 'delete_order' order.id %}">Remove</a></td>
</tr>
{% endfor %}
</table>
</div>
</div>
</div>
{% endblock %}

The NoReverseMatch error is saying that Django cannot find a matching url pattern for the url you've provided in any of your installed app's urls.
In your HTML write action=" {%url 'create_order' order.id%}"

Related

Problems with a backend part of search line in Django

who can explain me why my SearchView doesn't work. I have some code like this.It doesn't show me any mistakes, but it doesn't work. The page is clear. Seems like it doesn't see the input.
search.html
<div class="justify-content-center mb-3">
<div class="row">
<div class="col-md-8 offset-2">
<form action="{% url 'search' %}" method="get">
<div class="input-group">
<input type="text" name="q" class="form-control" placeholder="Search..." />
<div class="input-group-append">
<button class="btn btn-dark" type="submit" id="button-addon2">Search</button>
</div>
</div>
</form>
</div>
</div>
</div>
search/urls.py
path('search/', SearchView.as_view(), name='search')
search/views.py
class SearchView(ListView):
model = Question
template_name = 'forum/question_list.html'
def get_queryset(self):
query = self.request.GET.get("q")
object_list = Question.objects.filter(
Q(title__icontains=query) | Q(detail__icontains=query)
)
return object_list
forum/question_list.html
{% extends 'main/base.html' %}
{% block content %}
{% for question in object_list %}
<div class="card mb-3">
<div class="card-body">
<h4 class="card-title">{{ question.title }}</h4>
<p class="card-text">{{ question.detail }}</p>
<p>
{{ question.user.username }}
5 answers
10 comments
</p>
</div>
</div>
{% endfor %}
{% endblock %}

NoReverseMatch Django Project

I want to create the products through the customer's profile, so that the customer's name is attached to the form when creating the product that is related to it. But when I try to enter the user profiles from the dashboard it throws this error
urls.py
urlpatterns = [
path('', views.home, name="home"),
path('products/', views.products, name="products"),
path('customer/<str:pk_test>/', views.customer, name="customer"),
path('create_order/<str:pk>', views.createOrder, name='create_order'),
path('update_order/<str:pk>', views.updateOrder, name='update_order'),
path('delete_order/<str:pk>', views.deleteOrder, name='delete_order'),
path('create_customer/', views.createCustomer, name='create_customer'),
]
views.py
Here I focus on the "create Order" function passing the customer's primary key and using "initial" to append the customer's name to the form
def home(request):
orders_value = Order.objects.all()
customer_value = Customer.objects.all()
total_orders_value = orders_value.count()
total_customers_value = customer_value.count()
pending_value = orders_value.filter(status='Pending').count()
delivered_value = orders_value.filter(status='Delivered').count()
context = {'orders_key': orders_value, 'customer_key': customer_value,
'total_orders_key':total_orders_value, 'pending_key': pending_value,
'delivered_key': delivered_value}
return render (request, 'accounts/dashboard.html', context)
def products(request):
products_value = Product.objects.all()
return render (request, 'accounts/products.html', {'products_key': products_value})
def customer(request, pk_test):
customer_value = Customer.objects.get(id=pk_test)
orders_value = customer_value.order_set.all()
orders_value_count = orders_value.count()
context = {'customer_key':customer_value, 'orders_key': orders_value, 'orders_key_count': orders_value_count}
return render (request, 'accounts/customer.html', context)
def createOrder(request, pk):
customer = Customer.objects.get(id=pk)
form_value = OrderForm(initial={'customer':customer})
if request.method == 'POST':
form_value = OrderForm(request.POST)
if form_value.is_valid:
form_value.save()
return redirect('/')
context = {'form_key':form_value}
return render(request, 'accounts/order_form.html', context)
def updateOrder(request, pk):
order = Order.objects.get(id=pk)
form_value = OrderForm(instance=order)
if request.method == 'POST':
form_value = OrderForm(request.POST, instance=order)
if form_value.is_valid:
form_value.save()
return redirect('/')
context = {'form_key':form_value}
return render(request, 'accounts/order_form.html', context)
def deleteOrder(request, pk):
order = Order.objects.get(id=pk)
if request.method == 'POST':
order.delete()
return redirect('/')
context={'item':order}
return render (request, 'accounts/delete.html', context)
customer.html
{% extends 'accounts/main.html' %}
{% block content %}
<br>
<div class="row">
<div class="col-md">
<div class="card card-body">
<h5>Customer:</h5>
<hr>
<a class="btn btn-outline-info btn-sm btn-block" href="">Update Customer</a>
<a class="btn btn-outline-info btn-sm btn-block" href="{% url 'create_order' customer.id %}">Place Order</a>
</div>
</div>
<div class="col-md">
<div class="card card-body">
<h5>Contact Information</h5>
<hr>
<p>Email: {{customer_key.email}}</p>
<p>Phone: {{customer_key.phone}}</p>
</div>
</div>
<div class="col-md">
<div class="card card-body">
<h5>Total Orders</h5>
<hr>
<h1 style="text-align: center;padding: 10px">{{orders_key_count}}</h1>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col">
<div class="card card-body">
<form method="get">
<button class="btn btn-primary" type="submit">Search</button>
</form>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-md">
<div class="card card-body">
<table class="table table-sm">
<tr>
<th>Product</th>
<th>Category</th>
<th>Date Orderd</th>
<th>Status</th>
<th>Update</th>
<th>Remove</th>
</tr>
{% for order in orders_key %}
<tr>
<td>{{order.product}}</td>
<td>{{order.product.category}}</td>
<td>{{order.data_created}}</td>
<td>{{order.status}}</td>
<td>{{order.product}}</td>
<td><a class="btn btn-sm btn-info" href="{% url 'update_order' order.id %}">Update</a></td>
<td><a class="btn btn-sm btn-danger" href="{% url 'delete_order' order.id %}">Delete</a></td>
</tr>
{% endfor %}
</table>
</div>
</div>
</div>
{% endblock %}
dashboard.html
{% extends 'accounts/main.html' %}
{% block content %}
{% include 'accounts/status.html' %}
<br>
<div class="row">
<div class="col-md-5">
<h5>CUSTOMERS:</h5>
<hr>
<div class="card card-body">
<a class="btn btn-primary btn-sm btn-block" href="{% url 'create_customer' %}">Create Customer</a>
<table class="table table-sm">
<tr>
<th></th>
<th>Customer</th>
<th>Phone</th>
</tr>
{% for customer in customer_key %}
<tr>
<th><a class="btn btn-sm btn-info" href="{% url 'customer' customer.id %}">View</a></th>
<td>{{customer.name}}</td>
<td>{{customer.phone}}</td>
</tr>
{% endfor %}
</table>
</div>
</div>
<div class="col-md-7">
<h5>LAST 5 ORDERS</h5>
<hr>
<div class="card card-body">
<table class="table table-sm">
<tr>
<th>Product</th>
<th>Date Orderd</th>
<th>Status</th>
<th>Update</th>
<th>Remove</th>
</tr>
{% for orders in orders_key %}
<tr>
<td>{{orders.product}}</td>
<td>{{orders.data_created}}</td>
<td>{{orders.status}}</td>
<td><a class="btn btn-sm btn-info" href="{% url 'update_order' orders.id %}">Update</a></td>
<td><a class="btn btn-sm btn-danger" href="{% url 'delete_order' orders.id %}">Delete</a></td>
</tr>
{% endfor %}
</table>
</div>
</div>
</div>
{% endblock %}
This is the error that throws me
NoReverseMatch at /customer/1/
Error during template rendering
Reverse for 'create_order' with arguments '('',)' not found. 1 pattern(s) tried: ['create_order/(?P<pk>[^/]+)$']
Maybe i wrote some wrong in "customer.html" but i dont know where and i cant find the error... I need help, please
inside your template customer.html
change this(why ? because inside your context = {'customer_key':customer_value, 'orders_key': orders_value, 'orders_key_count': orders_value_count} that refers to this template there is no key called 'customer' and you tried to access again his id that is not correct)
<a class="btn btn-outline-info btn-sm btn-block" href="{% url 'create_order' customer.id %}">Place Order</a>
to (if you look your context you have a customer_key that is from your Customer model to get his id you can just use customer_key.pk)
<a class="btn btn-outline-info btn-sm btn-block" href="{% url 'create_order' customer_key.pk %}">Place Order</a>
there is some mistake inside your urls.py(pk is an integer so instead of str(string) you should use int(integer))
urlpatterns = [
path('', views.home, name="home"),
path('products/', views.products, name="products"),
path('customer/<int:pk_test>/', views.customer, name="customer"),
path('create_order/<int:pk>', views.createOrder, name='create_order'),
path('update_order/<int:pk>', views.updateOrder, name='update_order'),
path('delete_order/<int:pk>', views.deleteOrder, name='delete_order'),
path('create_customer/', views.createCustomer, name='create_customer'),
]

django:Reverse for 'detail' with no arguments not found. 1 pattern(s) tried: ['detail/(?P<pk>[0-9]+)/$']

I am trying to develop a web system in python3 and Django using the local environment.
when I try to use a DetailView and add pk in URL, I got stuck and I don't know why it's showing this error. I searched a lot and can't find an answer.
my condition
Mac: mojave 10.14.6
Python: 3.7.5
Django: 2.2.2
error message
Reverse for 'detail' with no arguments not found. 1 pattern(s) tried: ['detail/(?P<pk>[0-9]+)/$']
views.py
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse_lazy
from django.views import generic
class HomeView(LoginRequiredMixin, generic.ListView):
model = DbVegetableInfo
template_name = 'home.html'
def get_queryset(self):
queryset = DbVegetableInfo.objects.filter(user=self.request.user).order_by('-created_at')
return queryset
class DetailView(LoginRequiredMixin, generic.DetailView):
model = DbVegetableInfo
template_name = 'detail.html'
urls.py
from django.urls import path
from . import views
app_name = 'main'
urlpatterns = [
path('home/', views.HomeView.as_view(), name='home'),
path('detail/<int:pk>/', views.DetailView.as_view(), name='detail'),
]
home.html(ListView)
{% extends "layout/layout_home.html" %}
{% block javascript %}
{% endblock %}
{% block title %}
table
{% endblock %}
{% block content %}
<!-- page content -->
<div class="right_col" role="main">
<div class="">
<div class="page-title">
<div class="title_left">
<h3>test</h3>
</div>
<div class="title_right">
<div class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for...">
<span class="input-group-btn">
<button class="btn btn-secondary" type="button">Go!</button>
</span>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-8 offset-md-2">
{% if messages %}
<div class="container">
<div class="row">
<div class="my-div-style w-100">
<ul class="messages" style="list-style: none;">
{% for message in messages %}
<li {% if message.tags %} class="{{ message.tags }}" {% endif %}>
{{ message }}
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
{% endif %}
<div class="x_panel">
<div class="x_title">
<h2>test</h2>
<ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
aria-expanded="false"><i class="fa fa-wrench"></i></a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">Settings 1</a>
<a class="dropdown-item" href="#">Settings 2</a>
</div>
</li>
<li><a class="close-link"><i class="fa fa-close"></i></a>
</li>
</ul>
<div class="clearfix"></div>
</div>
<div class="x_content">
<table class="table table-striped projects" style="text-align: center">
<thead>
<tr>
<th style="width: 1%">#</th>
<th>test</th>
<th>test</th>
<th>test</th>
<th>test</th>
<th>test</th>
<th>test</th>
<th>test</th>
<th>test</th>
<th>test</th>
</tr>
</thead>
<tbody>
{% for vegetable_info in object_list %}
<tr style="font-size: 14px">
<td>
<p> {{ forloop.counter }}</p>
</td>
<td>
<p> {{ vegetable_info.weather_observation }}</p>
</td>
<td>
<p> {{ vegetable_info.field_name }}</p>
</td>
<td>
<p>{{ vegetable_info.plant_name }} </p>
</td>
<td>
<p>{{ vegetable_info.variety_name }} </p>
</td>
<td>
<p> {{ vegetable_info.start_date }}</p>
</td>
<td class="project_progress">
<div class="progress progress_sm">
<div class="progress-bar bg-green" role="progressbar"
data-transitiongoal=""></div>
</div>
<small>%</small>
</td>
<td>
<button type="button" style="pointer-events: none"
class="btn btn-success btn-sm ">test
</button>
</td>
<td>
<p></p>
</td>
<td>
<a href="{% url 'main:detail' object.pk %}"
class="btn btn-primary btn-sm"><i class="fa fa-folder"></i>
detail
</a>
</td>
</tr>
{% empty %}
<p>test</p>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
*I've already tryied this case but it has been still not solved...
Reverse for 'edit' with no arguments not found. 1 pattern(s) tried: ['articles/edit/(?P<pk>[0-9]+)/$']
Ok, either in your home.html you can see the instance of the view as follows
{% for object in object_list %}
<a href="{% url 'main:detail' object.pk %}"{{ object.title }}</a>
{% endfor %}
or you can create a seperate list view and its template
I could remove the error.
the reason why I had the error was simple, I had another html file which has a href tag to DetailViewclass() and I fixed it, after then the error was removed and it worked well.

Reverse for 'edit' with no arguments not found. 1 pattern(s) tried: ['articles/edit/(?P<pk>[0-9]+)/$']

I am a beginner in Django and now i am developing a blogging application. At the article editing section i got stucked and I dont know why its showing this error. Searched a lot and cant find an answer
NoReverseMatch at /articles/edit/2/
Reverse for 'edit' with no arguments not found. 1 pattern(s) tried: ['articles/edit/(?P<pk>[0-9]+)/$']
edit_articles section in
views.py
#login_required(login_url="/accounts/login/")
def edit_articles(request, pk):
article = get_object_or_404(Article, id=pk)
if request.method == 'POST':
form = forms.CreateArticle(request.POST, instance=article)
if form.is_valid():
post = form.save(commit=False)
post.author = request.user
post.save()
return redirect('articles:myarticles')
else:
form = forms.CreateArticle(instance=article)
return render(request, 'articles/article_edit.html', {'form': form})
article_edit.html
{% extends 'base_layout.html' %}
{% block content %}
<div class="create-article">
<form class="site-form" action="{% url 'articles:edit' %}" method="post" enctype="multipart/form-data">
{% csrf_token %}
<div class="jumbotron">
<div class="heading col-md-12 text-center">
<h1 class="b-heading">Edit Article</h1>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
{{ form.title }}
</div>
</div>
<div class="col-md-6">
<div class="form-group">
{{ form.slug }}
</div>
</div>
<div class="col-md-6">
<div class="form-group">
{{ form.thumb }}
</div>
</div>
<div class="col-md-12">
<div class="form-group">
{{ form.body }}
</div>
</div>
</div>
<button type="submit" class="btn btn-primary btn-lg btn-block">Update</button>
</div>
</form>
</div>
{% endblock %}
urls.py
from django.urls import path
from . import views
app_name = 'articles'
urlpatterns = [
path('', views.article_list, name='list'),
path('create/', views.article_create, name='create'),
path('edit/<int:pk>/', views.edit_articles, name='edit'),
path('myarticles/',views.my_articles, name='myarticles'),
path('<slug>/', views.article_detail, name='details'),
]
my_articles.html
That button in 4th is triggering the edit function with primary key and redirects to edit page
<tbody>
{% if articles %}
{% for article in articles %}
<tr class="table-active">
<th scope="row">1</th>
<td>{{ article.title }}</td>
<td>{{ article.date }}</td>
<td><button type="button" class="btn btn-info">Edit</button></td>
{% endfor %}
</tr>
{% else %}
<tr>
<td colspan=4 class="text-center text-danger">Oops!! You dont have any articles.</td>
</tr>
{% endif %}
In your template article_edit.html - post url is expecting a pk, you need to pass a pk just like you are doing it for template my_articles.html
<div class="create-article"><form class="site-form" action="{% url 'articles:edit' pk=form.instance.pk %}" method="post" enctype="multipart/form-data">{% csrf_token %}...
This way django knows which article you are editing

NoReverseMatch Django url issue

I am trying to implement a typical url in my django project however i keep getting the error meassage. I have checked my urls, views and html code where i have passed in the KWARGS. I have no clue what went wrong here please help?
The home.html uses user_profile_detail in the template
userprofile/home.html
<div class="sidebar-fixed position-fixed side_nav_bar ">
<a class="logo-wrapper waves-effect">
<img src="/" class="img-fluid" alt="">
</a>
<div class="list-group list-group-flush">
**<a href="{% url 'userprofile:dashboard' user_profile_detail.slug %}" class="list-group-item {% if request.path == dashboard %}active{% endif %} waves-effect">
<i class="fa fa-pie-chart mr-3"></i>Dashboard
</a>**
<a href="{% url 'userprofile:profile' user_profile_detail.slug %}" class="list-group-item {% if request.path == profile %}active{% endif %} list-group-item-action waves-effect">
<i class="fa fa-user mr-3"></i>Profile</a>
<a href="{% url 'userprofile:watchlist' user_profile_detail.slug %}" class="list-group-item {% if request.path == watchlist %}active{% endif %} list-group-item-action waves-effect">
<i class="fa fa-eye mr-3" aria-hidden="true"></i>WatchList</a>
<a href="{% url 'userprofile:blog' user_profile_detail.slug %}" class="list-group-item {% if request.path == blog %}active{% endif %} list-group-item-action waves-effect">
<i class="fa fa-book mr-3" aria-hidden="true"></i>My Blogs</a>
<a href="{% url 'userprofile:history' user_profile_detail.slug %}" class="list-group-item {% if request.path == history %}active{% endif %} list-group-item-action waves-effect">
<i class="fa fa-history mr-3" aria-hidden="true"></i>My Browsing History</a>
</div>
</div>
MODELS.PY
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
slug = models.SlugField(blank=True, unique=True)
VIEWS.PY
def dashboard_view(request, slug):
userprofile = Profile.objects.get(slug=slug)
user_viewed_object = userprofile.objectviewed_set.first()
user_blog = userprofile.userblog_set.first()
user_watchlist = userprofile.watchlist_set.first()
context = {
'user_profile_detail': userprofile,
'user_blog': user_blog,
'user_watchlist': user_watchlist,
'user_viewed_object': user_viewed_object,
'page_name': "Dashboard"
}
print(userprofile.slug)
return render(request, 'userprofile/home.html', context)
def profile_view(request, slug):
user_profile_detail = Profile.objects.get(slug=slug)
if request.method == 'POST':
form = ProfileForm(request.POST or None, request.FILES, instance=user_profile_detail)
if form.is_valid():
print(form)
form.save(commit=False)
user_profile_detail = request.user
form.save()
return HttpResponseRedirect('/')
context = {
'profile': user_profile_detail,
'page_name': 'Profile',
'form': form
}
return render(request, 'userprofile/profile.html', context)
URLS.PY
app_name = 'userprofile'
urlpatterns = [
path('<slug:slug>', dashboard_view, name="dashboard"),
path('<slug:slug>/user_profile/', profile_view, name='profile'),
path('<slug:slug>/watchlist/', watchlist_view, name='watchlist'),
path('<slug:slug>/blog/', userblog_view, name="blog"),
path('<slug:slug>/history/', user_history, name="history"),
]
ERROR MESSAGE:
NoReverseMatch at /profile/jacklit/user_profile/
Reverse for 'dashboard' with arguments '('',)' not found. 1 pattern(s) tried: ['profile\\/(?P<slug>[-a-zA-Z0-9_]+)$']
profile.html
{% extends 'userprofile/dashboard.html' %}
{% load crispy_forms_tags %}
{% block content %}
<div class="container-fluid mt-5">
{% include 'userprofile/dashboard_head.html' %}
{% include 'userprofile/large_center_modal.html' %}
<div class="card">
<h2 class="my-3 mx-3"><i class="fa fa-user mr-3" aria-hidden="true"></i>My Profile</h2>
<hr >
<div class="row my-5 mx-1">
<div class="col-3 text-center pl-3">
{% if profile.profile_picture %}
<img src="{{ profile.profile_picture.url }}" alt=""
class="img-fluid z-depth-1-half rounded-circle">
{% endif %}
<div style="height: 10px"></div>
<p class="title mb-0">{{ profile.first_name }} {{ profile.last_name }}</p><br>
<p class="title mb-0" style="font-size: 13px">{{ profile.role }}</p><br>
<p class="title mb-0"><b>Joined: </b>{{ profile.joined }}</p><br><br>
{% if request.user == profile.user %}
Edit Profile
{% endif %}
</div>
<div class="col-9">
<h3><u>Biography</u></h3>
<h6>{{ profile.biography }}</h6>
<hr>
<h6><i class="fa fa-envelope mr-3" aria-hidden="true"></i>Email Address: {{ profile.email }}</h6>
<h6><i class="fa fa-phone mr-3" aria-hidden="true"></i>Office Number:{{ profile.office_number }}</h6>
<h6><i class="fa fa-mobile-phone mr-3" aria-hidden="true"></i>Phone Number: {{ profile.phone_number }}</h6>
<br><br>
<h3><u>Contact Information</u></h3>
<h6>Email: {{ profile.email }}</h6>
<h6>Office: {{ profile.office_number }}</h6>
<h6>Phone: {{ profile.phone_number }}</h6><br><br>
<h3><u>Social Medias</u></h3>
<h6><i class="fa fa-google-plus mr-3"></i>Google Plus:</h6>
<h6><i class="fa fa-facebook mr-3"></i>Facebook: </h6>
<h6><i class="fa fa-twitter mr-3"></i>Twitter: </h6>
<h6><i class="fa fa-linkedin mr-3"></i>LinkedIn: </h6>
</div>
</div>
</div>
</div>
{% endblock %}
Large_center_Modal.html
<form action="{% url 'userprofile:profile' user_profile_detail.slug %}" enctype="multipart/form-data" method="post">
{% csrf_token %}
<div class="modal fade" id="centralModalLGInfoDemo" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg modal-notify modal-info" role="document">
<!--Content-->
<div class="modal-content">
<!--Header-->
<div class="modal-header">
<p class="heading lead">Update my Profie</p>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true" class="white-text">×</span>
</button>
</div>
<!--Body-->
<div class="modal-body">
<div class="">
<div class="col-10">{{ form | crispy }}</div>
</div>
</div>
<!--Footer-->
<div class="modal-footer">
<button type="submit" class="btn btn-outline-info waves-effect">Update</button>
</div>
</div>
<!--/.Content-->
</div>
</div>
</form>
Your context dict has profile key: 'profile': user_profile_detail,. So in template you should use profile instead of user_profile_detail:
"{% url 'userprofile:dashboard' profile.slug %}"