Today I learned how to create a search bar to search through my data and push the result to a dynamically routed page.
I searched some ways to ways to build the search bar without using the hook useRouter()
- Create your models
- This is how you define the data stored in the database and how that data is saved
- Create your forms (using ModelForm: https://docs.djangoproject.com/en/4.2/topics/forms/modelforms)
- Created view
- This makes the data (aka: context) available to the html template
- Create the template that interpolates the data from the view
- This renders the form
- Create a URL that serves the view to users
- EXAMPLE:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//repos | |
const pinnedRepos = [ | |
{ | |
id: 1, | |
type: 'Overview', | |
name: "gatsby-workshop", | |
description: "This workshop covers the fundamentals of developing fast, accesible sites with Gatsby, a React framework, and dive deep into the building blocks you'll need to build your own custom Gatsby sites." | |
}, | |
{ | |
id: 2, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//repos | |
const pinnedRepos = [ | |
{ | |
id: 1, | |
type: 'Overview', | |
name: "gatsby-workshop", | |
description: "This workshop covers the fundamentals of developing fast, accesible sites with Gatsby, a React framework, and dive deep into the building blocks you'll need to build your own custom Gatsby sites." | |
}, | |
{ | |
id: 2, |