I am passing a parameter in a url to another view and during the process it gets changed. An original parameter example that produces the error is OQYX/173774//ZYO but gets changed to '/viewLit/OQYX/173774/ZYO/' It drops the second / between 173774 and ZYO. I assumed this was because it was treating it as an escape character? So I tried adding an r in the urls.py file but it did not have any effect. Here is my template code for the page that generates the hyperlink:
<html> <head> <meta charset="UTF-8"> <title>Circuits</title> <style> h1 { color:blue; } h4 { color:red; } .tabledata { background: #395870; color:#fff; } .tablerow:nth-child(even) { background-color: #f2f2f2; } .form{ width:100%; } .field { background: #white; float: left; margin: 1%; width: 200; } </style> {% block content %} <h1 align="center">Search Lit Circuits</h1> <h6 align="center">Enter your search criteria below:</h6> <form method="get"> <table class="form" style="width:100%"> <tr> <th align="right">Circuit ID:</th><td><input type="text" name= "circuitid" maxlength="100"></td> <th align="right">Bandwidth:</th><td><input type="text" name= "bandwidth" maxlength="100"></td> <th align="right">Region:</th><td><input type="text" name= "region" maxlength="100"></td> </tr> <tr> <th align="right">Carrier:</th><td><input type="text" name= "carrier" maxlength="100"></td> <th align="right">Status:</th><td><input type="text" name= "status" maxlength="100"></td> <th align="right">Segmentname:</th><td><input type="text" name= "segmentname" maxlength="100"></td> </tr> <tr> <th align="right">MRC:</th><td><input type="text" name="mrcnew" maxlength="100"></td> </tr> </table> <button type="submit">Search</button> <a href="/searchlit/customsearch"> <input type="button" value="Clear" /></a> </form> <body> <p>{{ filter.qs.count }} circuits returned</p> <div> <table style="width:100%"> <thead class="tabledata"> <tr> <th> {% if user.is_authenticated %} Edit/ {% endif %} View </th> <th>CircuitID</th> <th>Bandwidth</th> <th>Region</th> <th>Carrier</th> <th>Status</th> <th>Segmentname</th> <th>MRC</th> </tr> </thead> <tbody> {% for circuit in filter.qs %} <tr class="tablerow"> <td class="actions"> {% if user.is_authenticated %} <a href="/editLit/{{ circuit.circuitid }}" target="_blank" class="edit-item" title="Edit">Edit</a> {% endif %} <a href="/viewLit/{{ circuit.circuitid }}" target="_blank" class="view-item" title="View">View</a> </td> <td>{{ circuit.circuitid }}</td> <td>{{ circuit.bandwidth }}</td> <td>{{ circuit.region }}</td> <td>{{ circuit.carrier }}</td> <td>{{ circuit.status }}</td> <td>{{ circuit.segmentname }}</td> <td>{{ circuit.mrcnew }}</td> </tr> {% endfor %} </tbody> </table> </div> </body> {% endblock %} </html> My project level urls.py file: """ciopsdb URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path, include from django.conf.urls import url urlpatterns = [ path('admin/', admin.site.urls), path('', include('homepage.urls')), path('searchlit/', include('searchLit.urls')), path('viewLit/', include('viewLit.urls')), ] My viewLit app's urls.py from django.urls import path, include from django.conf.urls import url from . import views urlpatterns= [ path(r'<path:circuitid>/', views.viewLit, name='viewLit'), ] My viewLit app's views.py from django.shortcuts import render from django.http import HttpResponse from django.views.generic import TemplateView from . models import Circuitinfotable, Budgettable, Xcinventorytable # Create your views here. def viewLit(request, circuitid): record = Circuitinfotable.objects.get(circuitid=circuitid) template = 'viewLit/viewCircuit.html' context = {'record':record} return render(request, template, context) The traceback that I receive as an error: Traceback:File "/home/db_user/ciopsdb/venv/lib64/python3.6/site-packages/django/core/handlers/exception.py" in inner 34. response = get_response(request)File "/home/db_user/ciopsdb/venv/lib64/python3.6/site-packages/django/core/handlers/base.py" in _get_response 115. response = self.process_exception_by_middleware(e, request)File "/home/db_user/ciopsdb/venv/lib64/python3.6/site-packages/django/core/handlers/base.py" in _get_response 113. response = wrapped_callback(request, *callback_args, **callback_kwargs)File "/home/db_user/ciopsdb/viewLit/views.py" in viewLit 9. record = Circuitinfotable.objects.get(circuitid=circuitid)File "/home/db_user/ciopsdb/venv/lib64/python3.6/site-packages/django/db/models/manager.py" in manager_method 82. return getattr(self.get_queryset(), name)(*args, **kwargs)File "/home/db_user/ciopsdb/venv/lib64/python3.6/site-packages/django/db/models/query.py" in get 408. self.model._meta.object_nameException Type: DoesNotExist at /viewLit/OQYX/173774/ZYO/Exception Value: Circuitinfotable matching query does not exist. Any suggestions are appreciated. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/49da6357-27be-42fa-8b88-fc9c223654d8%40googlegroups.com.