For reference search method: Mode.objects.search() is not something which is available by default in django, hence this is a new custom queryset method we are creating from zero. To create this we can do either: 1. custom Manager 2. Custom QuerySet Only difference is how they are linked to the model: 1. objects = ArticleCustomManager() 2. objects = ArticleCustomQuerySet.as_manager() FYI: objects is the default name that we used: remember Article.objects.
i think it is unnecessary implementing that complex queryset for searching a simple title or content in a blog. you make a lot of functions for handling the same data. I (personally) think it is not optimus way to program a search function. Please correct me if i am wrong.
If You use same search pattern in another view (for example) You repeat all this one on more time. It is not optimal (not DRY). In real project 100% probability. Here we sow more way to solve same problem. You make Yours choice in yours code.
I never ever thought that search query could be this much robust. This is really insane believe me. Sir, You really worked hard for Django.
Every time I think of a comment to put here for Justin, nothing comes to my mind first except 'QUALITY', well done Bro, We love you { from Egypt }.
What a great work on this course content, bravo
Love your explanations bro!!, you really make it easy to understand for me.
For reference search method: Mode.objects.search() is not something which is available by default in django, hence this is a new custom queryset method we are creating from zero. To create this we can do either:
1. custom Manager
2. Custom QuerySet
Only difference is how they are linked to the model:
1. objects = ArticleCustomManager()
2. objects = ArticleCustomQuerySet.as_manager()
FYI: objects is the default name that we used: remember Article.objects.
I see, so this overriding objects like overriding save method.
Hey Justin
Please use dark mode in browser as well. Please
i think it is unnecessary implementing that complex queryset for searching a simple title or content in a blog.
you make a lot of functions for handling the same data. I (personally) think it is not optimus way to program a search function.
Please correct me if i am wrong.
If You use same search pattern in another view (for example) You repeat all this one on more time. It is not optimal (not DRY). In real project 100% probability.
Here we sow more way to solve same problem. You make Yours choice in yours code.
At 4:20 line 15. In witch cases the query is None and in which cases the query is an empty string?