Im feeling rather sluggified after smashing through 14 Django tutorials.. 5 more to goo!! Learning lots here thanks mate!
@Codemycom4 жыл бұрын
ha fun
@pentestPY7 күн бұрын
Just watched this slugify video.. awesome, learned we can slugify and just delete the space and replace it with hyphen.. This thing is cool
@pooriyayousefi79143 жыл бұрын
you are a legend ! you are covering every concept that a blog needs . I don't google anymore :)) I use your videos xD big ups
@Codemycom3 жыл бұрын
I appreciate that!
@saeedyaqoob57843 жыл бұрын
Here is a solution to the case problem: Just add this to your Category model in models.py to override its existing save method. def save(self, *args, **kwargs): self.name = self.name.lower() return super(Category, self).save(*args, **kwargs) It will make sure every new entry/category is saved as lowercase in your database. You might have to remove the existing categories saved as title or uppercase. Hope this helps. @John Really helpful videos. Learning a lot from them. Keep up the good work.
@marz49642 жыл бұрын
Coding is working but newly added Car or Entertainment not working..your code works..but category lists show all lower case i dont like it what can i do?
Thanks! This fixed my "This page is not valid." error.
@maramsagheer33992 жыл бұрын
nice tutorial. i ran into a small issue where the normal categories wouldnt work after adding the slugify so i fixed it like this in case anyone was wondering. {% if " " in category.name %} {{ post.category }} {% else %} {{ post.category }} {% endif %}
@Ali_Alhajji2 жыл бұрын
Great tutorial! The way I would solve the space in the URL is adding a new field in the Category model for the URL. For example, "coding tutorial" category would have another field "coding-tutorial" and I would use that in the URL.
@hariharanbalasubramanianpr42434 жыл бұрын
SIr, When I try to slugify in the url its showing %20 instead of '-'. In my views.py under the categoryView I gave this def CategoryView(request, cats): category_post = Post.objects.filter(category = cats.replace('-', ' ')) return render(request, 'categories.html', {'cats':cats.title().replace('-', ' '), 'category_post':category_post}) What can be the mistake sir.. Thanks,
@animalcompilations8324 жыл бұрын
the same with me, and if you try the url with '-' the title delete the space between words
@smishra63783 жыл бұрын
Can you show the code in your home.html? You need to modify the url link of post.category in home.html, like this- - {{ post.category }}
@shawnbeans73894 жыл бұрын
good job codemy very nice. 👍👍👍
@Codemycom4 жыл бұрын
Thank you! 👍
@Codemycom4 жыл бұрын
▶️ Watch Entire Django Blog Playlist ✅ Subscribe To My KZbin Channel: bit.ly/3bWN6wj bit.ly/2IGzvOR ▶️ See More At: ✅ Join My Facebook Group: Codemy.com bit.ly/2GFmOBz ▶️ Learn to Code at Codemy.com ✅ Buy a Codemy T-Shirt! Take $30 off with coupon code: youtube1 bit.ly/2VC9WUN
@danielscheurwater55004 жыл бұрын
Thanks for all these vids man! Really helpfull!
@Codemycom4 жыл бұрын
Glad you like them!
@milliondollarmotivation62604 жыл бұрын
*Congratulations 40 K Subs*
@Codemycom4 жыл бұрын
Thanks!
@vinothv17204 жыл бұрын
But in my browser, instead of white space, Am getting "coding%20tutorials"... Even before adding slugify in that href... After adding also, I get the same... Not getting - instead of space... Why?
@eduardobranco34904 жыл бұрын
Cheers from Portugal! One thing , when we add a new category and write the name capitalised, we are sent to the "Sorry this page does not exist..." We must have to write with no caps, maybe because of the '.title()' object. You are great, thanks a lot!
@Codemycom4 жыл бұрын
Could be...play around with it and see.
@joseparedes42604 жыл бұрын
Filter using __iexact which takes all the arguments ignoring upper and lower case For example: Post.objects.filter(category__iexact=cats)
@angelraya86024 жыл бұрын
@@joseparedes4260 Thanks alot man! This had me stumped lol
@ranvijaysingh79673 жыл бұрын
@@joseparedes4260 thanks buddy it helped
@user-dy5ho4sj2w3 жыл бұрын
@@joseparedes4260 Worked for me too. Thank you! :)
@prusa163 жыл бұрын
I found the solution: When i add new category first letters are big but when i add new category first letters are small, it works. Hey John, thanks for your videos, great resources... And i have a problem with slugify... I am using latest django and i did same codes with yours... def CategoryView(request, cats): category_posts = Post.objects.filter(category=cats.replace('-', ' ')) return render(request, 'categories.html', {'cats': cats.title().replace('-', ' '), 'category_posts':category_posts}) But i still have a sorry page doesnt exist. I also check typo errors but nothing :( Could you solve this?
@abhishekgawali1654 жыл бұрын
Great job man, loved it
@Codemycom4 жыл бұрын
Thanks a lot!
@abhayamagdum46524 жыл бұрын
Hey.. I'm just loving the way you teach😊 I am getting %20 in URL for space and unable to slugify it. URL with space is invalid in my case. Please suggest
@Codemycom4 жыл бұрын
Check your code for errors
@samuellee14314 жыл бұрын
What worked for me was in my views python file, I had to add .title() in my Post.objects.filter in the CategoryView function. Original: CategoryView(request, cats): category_posts = Post.objects.filter(category = cats.replace('-', ' ')) ....,etc. After: CategoryView(request,cats): category_posts = Post.objects.filter(category = cats.title().replace('-', ' ')
@kykurniawan4 жыл бұрын
@@samuellee1431 thanks this saved my time
@narayanpanta16683 жыл бұрын
@@samuellee1431 Thank you so much you save my time
@athishga30963 жыл бұрын
@@samuellee1431 thanks a lot dood.. It helped me alot....
@htshongany49694 жыл бұрын
Hi I like your videos I have difficulty with english but I understand that very well
@htshongany49694 жыл бұрын
I realized that when the category is upper-case, it can be a problem
@Codemycom4 жыл бұрын
Glad you like them
@Codemycom4 жыл бұрын
@@htshongany4969 You could write some code to change everything to lowercase if you have a problem with it
@htshongany49694 жыл бұрын
I'm looking for a solution
@htshongany49694 жыл бұрын
I tried yesterday and I've had some unexpected behavior. I plan to try again today.
@ogananfe2 жыл бұрын
Excellent tutorial💞👍 but i think we have a bug. What happens if someone happens to name a category "co-operative"? There would be no match in the module once we decide to replace all the "-" with spaces because we would be looking for co operative in the database. I feel like we should have used primary keys instead of category names in the urls.
@sgtdypen Жыл бұрын
categories will be listed in the dropdown , and user will select it not by entering in url.
@davidmejia96013 жыл бұрын
you save my day bro... thanks a lot.....
@Codemycom3 жыл бұрын
Happy to help
@amangautam17792 жыл бұрын
thanks walter white!!
@Codemycom2 жыл бұрын
Ha!
@RyantheCanuckpirate Жыл бұрын
Say my domain name.
@danielkraus56624 жыл бұрын
Great videos! Please do one with adding subcategories for the categories or even a star rating system similar to the likes button.
@Codemycom4 жыл бұрын
Probably won't go that in depth in this basic course.
@danielkraus56624 жыл бұрын
@@Codemycom ok
@letslearnui3 жыл бұрын
I tried the same process but I am not able to slugify the categories with two words. The category/categry-name does not load the posts Please help thanks
@omarmughrabi14192 жыл бұрын
Thanks for the great tutorials, actually I am able to follow every concept explained in this series. But for this tutorial I am having a concern for applying slugify on spaces contained category and then replacing the dash later on with space for categories that might have dash already like "anti-bodies". Is there a way to have a user defined slugify character to be & or % or maybe both instead of -?! 😁
@el_bartomedia4 жыл бұрын
best video men!!!
@Codemycom4 жыл бұрын
Thanks!
@Kyotox044 жыл бұрын
You look like #Heisenberg from breaking bad. Thanks for the Slugify.
@Codemycom4 жыл бұрын
Ha!
@ashutoshrai3233 жыл бұрын
Probably in 15-20 years..😂
@joeboyle7324 жыл бұрын
Just in case anyone else runs into a problem here, if your categories have upper case letters at any point then slugify will convert them to lower case and the filter may not pick them up
@Codemycom4 жыл бұрын
That's easily changed...
@open-source-is-the-answer4 жыл бұрын
@@Codemycom how do you do it the easiest way? should I replace Post.objects.filter... with some lambda expression to ignoring case when searching? or is it much simpler?
@dennismartin54554 жыл бұрын
What if your category has hyphens and spaces in it, such as, "Brother-In-Law Advice"?
@Codemycom4 жыл бұрын
tinker around with it and find out :-p
@suvarneshkm48454 жыл бұрын
Can you make a video on "how to use a api inside a django app! "
@Codemycom4 жыл бұрын
I've done several courses on that. Check the channel or codemy.com
@suvarneshkm48454 жыл бұрын
@@Codemycom but I am not have enough money to spend so plz do the api part for me !
@dradrigapatrick4 жыл бұрын
Slugify option doesnt work for me at all Any way i can solve it?
@Codemycom4 жыл бұрын
check your code for typos...things don't arbitrarily not work for some people, you have an error in your code
@miraccan004 жыл бұрын
John I think you should research some KZbin Seo. I believe you will reach your goals
@Codemycom4 жыл бұрын
I helped invent the SEO industry lol I created one of the first SEO tools back in the late 90's called the Submission-Spider
@lenterahitam65193 жыл бұрын
How do you show the number of items in the model to the template, for example, the number of books in each category?
@saidsaid-nn1qk4 жыл бұрын
After adding "slugify" and replace function, when I try to go onto categories other than coding, it redirects to "sorry page doesn't exist. Is it only happening to me or is it the same with your code?
@Codemycom4 жыл бұрын
It's just you
@DavidLejeune773 жыл бұрын
Had the same error , check if you used capital letters somewhere in your category name
@hamzazahir18842 жыл бұрын
Does anyone knows how to stop the site from adding the SAME category name again which has already been added to the database? For example once the user adds a category named "cars" and the user enters the same category again instead of adding, It should tell the user that this category has already been included in database.
@haack7911 ай бұрын
if you just slugify the category when saving them you don't have to worry about adding slugify in all the other spots and then doing all that logic to replace - with ' ' except for title.
@Codemycom11 ай бұрын
sure, always a million different ways to do anything
@haack7911 ай бұрын
@@Codemycom true, thanks for this tutorial, its great.
@ulvidamirli27584 жыл бұрын
Thank you for this beautiful video! I decided to go with django-autoslug package.. But every word I write in URL works, it doesn't give a 404 error. Looks like I'm missing something somewhere
@Codemycom4 жыл бұрын
Coolio
@nooobgamer014 жыл бұрын
❤❤👍👍
@Codemycom4 жыл бұрын
:-)
@sambad84293 жыл бұрын
what if some titles has - and others not?
@moiiin2654 жыл бұрын
Is there a way I can make category urls in foreign languages? I searched code "slug=modles.SlugField(allow_unicode=True)" but still don't know how to apply this in my models.py and urls.py
@miraccan004 жыл бұрын
is not correct? please. when ı enter into my category it's empty
@Codemycom4 жыл бұрын
if you named your model something else besides category....
@anonymousghost53843 жыл бұрын
Iuse vuejs to categorize posts without reload page
@trippy_b4 жыл бұрын
and what would be a URL pattern for this, please?
@leosoltys43534 жыл бұрын
Thank you for this lesson John! But after 06:36 still its possible to reach 127.0.0.1:8000/category/coding tutorials/ (with space) How we can make 127.0.0.1:8000/category/coding tutorials/ this page deactive?
@plusk3434 жыл бұрын
URLs don't contain spaces.
@dipeshmandanka56073 жыл бұрын
+1
@Morimove Жыл бұрын
slugigy all changes the captital letters into lowecase
@ilijataseski68553 жыл бұрын
If a category is Hiking and not hiking. you need ... |slugify|capfirst .....
@mustafaongun8548 Жыл бұрын
Thank you Walter White
@Codemycom Жыл бұрын
lol
@gamerstrim4 жыл бұрын
Please create video course about discord bot with python
@Codemycom4 жыл бұрын
That's not really my thing, sorry.
@diallomamadoudioulde82524 жыл бұрын
Hello thanks you for the tutorials ! Please how can I display videos saved in my database on my Django Website ? Thanks you in advance.
@Codemycom4 жыл бұрын
People generally don't save videos in databases.
@diallomamadoudioulde82524 жыл бұрын
@@Codemycom okay so how I can upload and read videos on my website ?
@Codemycom4 жыл бұрын
@@diallomamadoudioulde8252 Most people host videos on sites like vimeo, or youtube, and just paste embed code onto their website to play the videos.
@diallomamadoudioulde82524 жыл бұрын
@@Codemycom OK thanks anyway. I can't do it so it's too complicated I think.