Tuesday, November 26, 2019

Re: Trying to update a record using UpdateView Error: Circuitinfotable matching query does not exist

Yea! This toolbar is an awesome tool thanks for the tip.  So now I guess I'm not understanding how to route url's really.  The a href is:
 <a href="/viewLit/edit/jira/{{record.circuitid}}" class="edit-item" target="blank" title="Edit">Edit Jira Info</a><br>

My project level urls.py is:

from django.contrib import admin
from django.urls import path, include
from django.conf.urls import url
import debug_toolbar

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('homepage.urls')),
    path('searchlit/', include('searchLit.urls')),
    path('viewLit/edit/', include('editLit.urls')),
    path('viewLit/', include('viewLit.urls')),
    path('edit/', include('editLit.urls')),
    path(r'^__debug__/', include(debug_toolbar.urls)),
]

my editLit urls.py is:
from django.urls import path, include
from django.conf.urls import  url
from . import views

urlpatterns= [
     path('edit/circuit/<str:circuitid>', views.editLit.as_view(),name='editLit'),
]


And finally my editLit views.py is:
class editLit(UpdateView):
    pk_url_kwarg = 'circuitid'
    model=Circuitinfotable
    template="/editLit/editCircuit.html"
    fields = '__all__'


So I don't understand either how to just pull the param without the edit/circuit/ part or can that be stripped before it is passed to the view?

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9685efa1-b9b1-46e2-b831-d6144e0ebdf2%40googlegroups.com.

No comments:

Post a Comment