Saturday, September 23, 2017

capturing url pattern from html forms


Hi - 

If the number '1' is submitted with the form below, the following url is created:  http://localhost:8000/item/?id=1

But I continually get a page not found.  How can I style the regex in the urlpatterns so that this url registers?  Thanks. 

<form id="form" form action = "item/" method="get">
Item Name:<br>
<input id="entry" type="text" name="id"><br>
<br><br>
<input type="submit" value="Submit">
</form>

I'm attempting to capture here: 

urlpatterns = [
# Examples:
url(r'^admin/', include(admin.site.urls)),
# url(r'^item\/\?id=(?P<id>\d+)/', views.item_detail, name='item_detail'),
url(r'^item/(?P<id>\d+)/', views.item_detail, name='item_detail'),
# JSON files






--
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 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/0f8a8292-9cbb-42fc-8bc3-d3b7f7e2e694%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment