Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
How search is working?
I have not seen the search function in any of the previous videos , and what does " term = request.GET.get('q') " do.
Quite a late answer, but maybe this will help someone:
When there is a form with
method="GET all input fields will be added to URL of the submit request.
<input type="search" name="q"> means
"q=Android" will be added to the next URL.
When handling the request
request.GET returns a dictionary of all the URL parameters of GET request: so
/courses/search/?q=Android will return
.get('q') gets the value for the 'q'.