Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Set up the search query server side

  • Loading branch information...
commit 2c78db29ad5740b40882489b5ba39a21203bad0f 1 parent 1fbec0b
@rahulkgupta authored
View
3  .gitignore
@@ -1,2 +1,3 @@
*.pyc
-*DS_Store
+*.DS_Store
+*.Python
View
2  spatula/urls.py
@@ -7,7 +7,7 @@
urlpatterns = patterns('',
# Examples:
url(r'^$', 'spatula.views.home', name='home'),
- url(r'^search/(?P<food>\w+)$', 'spatula.views.search'),
+ url(r'^search', 'spatula.views.search'),
url(r'^timeline$', 'spatula.views.timeline'),
url(r'^step2$', 'spatula.views.step2'),
url(r'^step3$', 'spatula.views.step3')
View
5 spatula/views.py
@@ -16,8 +16,9 @@ def step3(request):
return render_to_response('step3.html', {},context_instance=RequestContext(request)
)
-def search(request, food):
- return HttpResponse("Search results " + food)
+def search(request):
+ search = request.GET['query']
+ return HttpResponse("Search results " + search)
def timeline(request):
View
7 templates/timeline.html
@@ -86,10 +86,11 @@ <h3 id="myModalLabel">Add a recipe</h3>
<div class="modal-body">
<strong>Search for a recipe. Once you are done, click the timline tab on the topbar to resume cooking.</strong>
<div>
- <form class="navbar-search">
- <input type="text" class="search-query" placeholder="Search">
+ <form name="input" class="navbar-search" action="search" method="get">
+ <input type="text" class="search-query" name="query" placeholder="Search">
+ <button type="submit" class="btn btn-primary" >Search</button>
</form>
- <button class="btn btn-primary">Search</button>
+
</div>
</div>
<div class="modal-footer">
Please sign in to comment.
Something went wrong with that request. Please try again.