Daniel, thank you so much! I had been eyeing my regex with suspicion by was looking at the wrong pattern. Many thanks again, all appeas to be working fine now :)
On Monday, 2 April 2018 12:27:56 UTC+1, Daniel Roseman wrote: > > On Monday, 2 April 2018 12:00:31 UTC+1, Will Burchell wrote: > > <snip> > > >> from django.conf.urls import url >> from . import views >> >> app_name = 'stock' # Referenced by template, ie <li> item in index.html >> >> urlpatterns = [ >> # /stock/ >> url(r'^$', views.index, name="index"), >> # /stock/nnn/ >> url(r'^(?P<stock_id>[0-9]+)/$', views.detail, name="detail"), >> # /stock/supplier >> url(r'^supplier', views.supplier, name="supplier"), >> # /stock/supplier/nnn/ >> url(r'^supplier/(?P<supplier_id>[0-9]+)/$', views.supplierdetail, >> name="supplierdetail"), >> ] >> > > > Firstly, as a clarification, URLs don't map to templates at all; they map > to views, and views may or may not render templates. But you do seem to > know this. > > Your problem however is simply to do with regexes; you don't terminate > your supplier pattern, so it matches everything beginning with "supplier". > It should be: > > url(r'^supplier$', views.supplier, name="supplier"), > > or use the new path syntax in Django 2.0: > > path('supplier', ...) > > -- > DR. > -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/29366cc5-07ef-4239-aa1d-648069961eda%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.