On Saturday, 23 September 2017 19:48:37 UTC+1, Mel DeJesus wrote:
>
>
> 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 
>
>
>

GET parameters are not captured in URL patterns. Just accept `^item/$` and 
get the data inside the view via `request.GET['id']`.
-- 
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 [email protected].
To post to this group, send email to [email protected].
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/e29da92a-14d3-4088-9a88-bd943c2e7e5b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to