Questions tagged [django-url-reverse]

77 questions
1
vote
1 answer

Django: NoReverseMatch at

So when I go to the url: http://127.0.0.1:8000/post/2/. instead of showing me the post detail view, it gives me an error. I am so confused about it. However I can see it in list view and in profile page. Edited: added error image and…
1
vote
0 answers

Django Dynamic Url Error in href attribute

Hi I'm trying to view profile page at articles/profile/ When I add profile page link, navbar doesn't work. If I remove articles:profile article.author_id from navbar.html all links works. My Error Message is here: NoReverseMatch at…
1
vote
1 answer

Django Rest Framework Routing: Reverse for 'orders' not found. 'orders' is not a valid view function or pattern name

I'm not quite sure I'm understanding how routing works in DRF. I went through the documentation but still haven't grasp the differences. I've got the following view: from django.shortcuts import render from django.shortcuts import…
1
vote
2 answers

Django can i reverse a parameterized url without passing any arguments?

app_name = 'app_name' path('url/',someview.as_view(),name='somename') def get_url(): return reverse('app_name:somename',args=None) I want get_url to return 'url/' Is it possible? If not, can i somehow get the partial url without the…
Ahsan
  • 31
  • 1
  • 6
1
vote
1 answer

Django - reverse nested url with drf-nested-routers

I configured my api url as localhost:port/app_name/students/{student_id}/macro/{macro_id}/lto using drf-nested-routers extension. Basically, each students has some macro categories assigned, that in turns have some Long Term Objectives (LTOs). I've…
1
vote
0 answers

Reverse for 'project_detail' with keyword arguments '{'pk': ''}' not found. 1 pattern(s) tried: ['catalog/projects/(?P[0-9]+)/$']

I am trying to figure out why it is that I am getting the following error: NoReverseMatch at /catalog/projects/delete/1/ Reverse for 'project_detail' with keyword arguments '{'pk': ''}' not found. 1 pattern(s) tried:…
1
vote
1 answer

Reverse for 'evolucion_paciente' with arguments '(5,)' not found. 1 pattern(s) tried: ['evolucion_paciente/(?P[0-9]+)/(?P[0-9]+)$']

I have created a view that accepts 3 arguments but I get the following error in the homepage.Reverse for 'evolucion_paciente' with arguments '(5,)' not found. 1 pattern(s) tried: ['evolucion_paciente/(?P[0-9]+)/(?P[0-9]+)$'] Project/views.py -- One…
1
vote
1 answer

Django Python 3.* : Reverse for 'view' not found

I have a first_view that takes id argument, And second_view that redirects to first_view after interpreting some code. views.py: def first_view(request, id): #do something return render(request, 'sometemplate.html') def second_view(request,…
1
vote
2 answers

Error with reverse function in django. Can't match a pattern

I am creating my first website using Django. While creating a form and returning the website to the details page of the just created page I came with this NoReverseMatch problem at /books/books/add/ Reverse for 'detail' with keyword arguments…
Drish Mali
  • 35
  • 8
1
vote
1 answer

How get an exception if {% url 'some-url-name' as the_url %} fails?

According to the docs of url the_url is empty if the reverse of the url fails: {% url 'some-url-name' as the_url %} In my case I would like to get an exception, since I want my tests to fail if my code is broken. How to store the result of reverse…
guettli
  • 25,042
  • 81
  • 346
  • 663
0
votes
0 answers

Redirection in Class Based Views Doesn't Completly Work

views.py: class LoveLetterCreateView(LoginRequiredMixin, CreateView): model = LoveLetter fields = '__all__' success_url = reverse_lazy('login') # NOT WORKING class SignUpView(CreateView): form_class = UserCreationForm …
0
votes
1 answer

NoReverseMatch at /abampdb/get/ in django

i am encountering a problem Exception Type: NoReverseMatch Exception Value: Reverse for 'show-protein' not found. 'show-protein' is not a valid view function or pattern name.
74
0
votes
1 answer

django redirect url concatenating to the previous url, help me to stop concatenating

this is my previouse url - http://127.0.0.1:8000/viewbook/8/viewchapter/57/ this is the url I want to redirect - http://127.0.0.1:8000/viewbook/8/viewchapter/57/ but its redirect me to this url -…
0
votes
0 answers

Generated // in the URL (Django)

Somehow my program generated two slashes // when I tried to add a new Menu item. Don't know how to fix that Page not found (404) Request Method:POSTRequest URL:http://127.0.0.1:8000/restaurant/menu/desserts-menu//add_menuItem/ Using the URLconf…
0
votes
1 answer

NoReverseMatch at /en/dashboard/server-request/

Reverse for 'edit_server_request' with arguments '(2,)' not found. 1 pattern(s) tried: ['en/dashboard/edit-server-request/int:pk'] the edit and delete button on the template below raises the error: