▶️ Watch Entire Django Blog Playlist ✅ Subscribe To My TH-cam 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
actually we don't need to calculate total_likes and liked variables in views and pass them to template. all of it can be done in template itself: number of likes: likes: {{ post.likes.count }} button (filled or outlined depending on if post is liked or not) Like
Hello nice video! One tip: after log in it would be nice for user to be redirected to that blog post. So if anyone wonders how, this works: Log in to like this article!
Absolutely love this series and really appreciate you uploading it all on YT. One quick question. If I want to display the number of dislikes a post garners from other users, will I have to build a 'copy' of this structure but purely for dislikes... or is there a 'quick fix' method? Still a noob myself and thought I'd ask here if anyone has tackled this before (I will also attempt it on my own with the 'copy' of the same structure so that I end up with a system to display 'likes' and 'dislikes')
Thanks for your video. I guess using jQuery could be a better solution as HttpResponseRedirect is rendering and refreshing all the template for just a like/dislike event.
Hi I am getting this error on pressing the unlike button : No Post matches the given query. You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page. Plz help
I need help for my app Django. My aim is that, when I publish my posts through the administration panel, they must automatically appear on index.html, without refreshing the page. I tried to use Ajax and Websocket, but they only continually recharhe the DIV. Is there another way?
Hello sir Can you make like dislike buttons like TH-cam i.e if user likes the post the like counts gets increased n if dislike the dislike count will increase.... user can either like or dislike post
Great video! Can you add a like button also along with the count in the list of posts view instead of limiting it to going to the detail view of the post?
i can easily say i totally didn't understand the function get_object_data ,frontend backend thing, Is it normal for a beginner(its been 1 month)? should i just copy paste some code to get use to it?
I added one additional layer. A user should not be able to like their own post, so after the "if user.is_authenticated" I added another "if user.id != post.author.id" and place your buttons inside that block. Don't forget your "endif" before your "else" of the "user.is_authenticated" block
@@Codemycom just like you created a like button and than add a condition so it changes into dislike according to that i tried the same but its not changing into dislike.. {% csrf_token %} {% if is_liked %}
@@theglammcoder To accomplish this, I actually created another form for the dislikes. That does mean that I also needed to modify the models.py, views.py and urls.py accordingly. Give it a try. If you still don't have it, post here again, and I will share more. I also needed to migrate my database again due to the change in the models.py. I have not yet set it so you cannot both like and dislike a post, but it's getting late and I need to stop for the night.
hey, would you please make a video or share some reference on how to add the like unlike buttons on the HomeView I'm kinda not able to add those buttons in HomeView...
▶️ Watch Entire Django Blog Playlist ✅ Subscribe To My TH-cam 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
How can we add like button in home or index view?? Is it possible...I tried but didnt work for me...
actually we don't need to calculate total_likes and liked variables in views and pass them to template. all of it can be done in template itself:
number of likes:
likes: {{ post.likes.count }}
button (filled or outlined depending on if post is liked or not)
Like
Thanks bro it's a perfectly)
@@darwinsterritory Thanks a lot! You really helped me!
@@mrbuslov Мне то за что :D
@@darwinsterritory Хаха, прости, не на то ответил)
Thank you! You really helped me
Hello nice video!
One tip: after log in it would be nice for user to be redirected to that blog post. So if anyone wonders how, this works:
Log in to like this article!
Having a great time learning. its so easy and simple with pure python.
Absolutely love this series and really appreciate you uploading it all on YT.
One quick question. If I want to display the number of dislikes a post garners from other users, will I have to build a 'copy' of this structure but purely for dislikes... or is there a 'quick fix' method?
Still a noob myself and thought I'd ask here if anyone has tackled this before (I will also attempt it on my own with the 'copy' of the same structure so that I end up with a system to display 'likes' and 'dislikes')
Thanks bro! I am Russian, but I watch your vidos. Thank!
Glad to hear that
how can we add other db??like postgresql..would u please make a video on that
Just add it to your settings.py file
MAN I FUCKING LOVE YOU! YOU'RE BUENARDO! Greetings from Argentina
Thanks!
Thanks for your video. I guess using jQuery could be a better solution as HttpResponseRedirect is rendering and refreshing all the template for just a like/dislike event.
could be
post.likes.filter(id=request.user.id) is weird, it must of been post.likes.filter(user=request.user.id) 😐
I get a error
stuff = get_object_or_404(Post, id=self.kwargs['pk'])
KeyError: 'pk'
please can someone to fix it?
I'm getting an error ('ManyToManyDescriptor' object has no attribute 'filter') when I click the dislike button any idea why?
What did you do differently from the video?
Hi I am getting this error on pressing the unlike button :
No Post matches the given query.
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
Plz help
if I set DEBUG = False
Then it gives allowed hosts error, If I set allowed hosts = ['*']
then also it doesn't work
You have a typo in your code somewhere...recheck your steps
No, the like thing works fine, but when I press the unlike again this comes.
@@abhishekbobbillapati692 help plz.
@@abhishekbobbillapati692 heyyy!!!! would you mind , helping me out with this ?
Thanks a lot for all. I don't understand the "liked" in LikeView : no effect.
I need help for my app Django.
My aim is that, when I publish my posts through the administration panel, they must automatically appear on index.html, without refreshing the page.
I tried to use Ajax and Websocket, but they only continually recharhe the DIV.
Is there another way?
Would you make a video on how to add photo/s and or video/s to a blog post? Thank you in advance :)
Yeah will likely do that.
@@Codemycom Thanks!
UnboundLocalError at /article/4
local variable 'liked' referenced before assignment - getting this error what to do sir?
These (like ,unlike)are the videos I was waiting for.please do video for save button too
save what?
Codemy.com I mean like reddit.save blog for future reference
thanks a lot!! Extremely helpful!
Glad it helped!
I am getting "HTTP ERROR 405" when I click Like button
When I'm hiding the author field, I'm getting this error hidden field author select a valid choice
Hello sir
Can you make like dislike buttons like TH-cam i.e if user likes the post the like counts gets increased n if dislike the dislike count will increase.... user can either like or dislike post
How can you avoid refresh? otherwise it would be difficult for users to comeback to where they were after page refresh
Am actually getting as Bachelors in Django from here 😊
Thanks dude, very helpful
Glad it helped
too helpful
Great video! Can you add a like button also along with the count in the list of posts view instead of limiting it to going to the detail view of the post?
Sure...but why not try it yourself. You have the tools now.
@@Codemycom I will, thanks a lot really good video! One quick question is there a solution to avoid the page refreshing every time you like a post?
@@ahmedkhairy482 not really.. only if you give up all of this simple method and get AJAX.js integrated.
@@ahmedkhairy482 django channels
Isn't then the liked in LikeView useless? I deleted it and it worked the same.
How can we list the users usernames who liked the post?
i can easily say i totally didn't understand the function get_object_data ,frontend backend thing, Is it normal for a beginner(its been 1 month)? should i just copy paste some code to get use to it?
probably :-p
Today`s Friday had a great explanation moment !!!!!
Well explained.
Thank you.
Glad you liked it!
Nice video
Thanks!
❤❤❤❤
thanks
I can't make comments under the post. Can you do this in next video?
I'll likely look at comments eventually
I added one additional layer. A user should not be able to like their own post, so after the "if user.is_authenticated" I added another "if user.id != post.author.id" and place your buttons inside that block.
Don't forget your "endif" before your "else" of the "user.is_authenticated" block
cool
pls demonstrate the sample
i am watching this video today and guess what it's Friday
Nice!
where can I get a complete code for these tutorials
github.com/flatplanet/djangoblog
Noice.
I am trying to add a like button and a dislike button just like we have on youtube but couldn't able to do it ?? anyone can help me oout ??
What problem are you having? Can you rewatch the video and follow along?
@@Codemycom just like you created a like button and than add a condition so it changes into dislike according to that i tried the same but its not changing into dislike..
{% csrf_token %}
{% if is_liked %}
{% else %}
{% endif %}
{{ post.total_likes }} Likes
@@theglammcoder To accomplish this, I actually created another form for the dislikes.
That does mean that I also needed to modify the models.py, views.py and urls.py accordingly. Give it a try. If you still don't have it, post here again, and I will share more. I also needed to migrate my database again due to the change in the models.py. I have not yet set it so you cannot both like and dislike a post, but it's getting late and I need to stop for the night.
hey, would you please make a video or share some reference on how to add the like unlike buttons on the HomeView I'm kinda not able to add those buttons in HomeView...
i'm facing keyerror at pk if i try doing code in HomeView Class
@@avishkarhande I did it, do you still want the solution ?
@@samixpunch9678 hi! I would really like to know how you did it please. ive been having trouble doing it
@@SLimerated You have a discord ? Add me SamiNur#9889
When is the next video?
today
Wait for next vedio... In blog series....
I got bored with it...I'll get back to it in a week or so
Codemy.com can I vote for maybe how to host or add google analytics 🙂
@@Confusedcapybara8772 not a bad idea