Hello, friend, welcome back.
In a previous video, we successfully display all the terror flowing, you are all that polls, right?
And also here I display our discontent with the details.
So now in this video I want to discuss about here, I want to to add on the option for the like or dislike
this post.
So it'll be just like our blog project into the blog post.
I have already discussed about that things with you.
So now I want to do want to apply the same things again in our social media project.
So if you want to do that work, first of all, you have to do we have to work.
In our view, that means you have to create two of these functions.
One would be as a like another will be as unlike.
Right.
So that is our home.
That means if you go to our app, that means our app post, and that is are opposing views.
And here, first of all, I want to the creation of the function.
OK, so before that function, I want to remember that things we do, like if you go to the airport
and if you go to our airport in the models, you the model area, I have already created one of the
class, as I like right now with this, like I have already created the deletion outpost and I have
created the one of the following declared the front without pause and also for the user I have created
on the foreign GI with our user class.
Right.
So now we have to do first of all, we have to get it.
That means we have to take out this class.
So that is opposed.
If you go to our home view, that means that is our home view.
So here, first of all, we have to add it.
So that is in our app model.
So I have already put that post.
Now, after that, I want to do and input another one that will be as a like.
Right.
That is our opposed and from the model.
So from the model.
I want to get out this class.
So now I load out this class.
So after that I want to create one of the function that means this function also be required.
That means blocking the grade.
I make it as a logging vehicle.
And after that, after that, I name the function.
If you at that function, I name it as a like OK name doesn't like the function.
And also here we have to pass that request and also here we have to pass our idea because of all every
polls that have individuals that have the ID.
Right, that is actually one of the ID.
That is our worst idea because we have to like it with a specific one of this idea post.
So for doing this, I want to do to add another parameter and I just take the parameter as ID RPK that
is the primary key.
And sorry I added that our ID and then I take one of the variable as post.
First of all, we have to do have to get all that our that data right.
So now I don't want to get our post and with this post class I want to get that objects and then I want
to get I want to get our whois that.
I want to get our specific idea that that means in our database, if you go to our disk, that is actually
one of the table.
That's for this table to have one of the ID.
So that is a beautiful idea actually created by this Django.
So now I want to do to take that idea as a picture so you will be matched with our which one each will
be matched with our D requested our ID.
Right.
So I wanted one to match it without this requested I.D. So that will be our primary key.
And after that I want to take another variable as I already like.
OK, already already underscore like so this type of one of the parameter and here I want to do I want
to with our life model.
I have already lowered our diskless right.
There is a like class.
So with this like class, I don't want to get our I want to filter it, I want to filter it our appropriate
post.
And also I have to compare our user.
Right.
Because of all there is a class post under the user.
So now we have to combine both of these steps here.
So with this like I want to do to get our objects, objects, and then I want to filter out the filter.
I want to filter with what I want to filter without this post.
That means this post.
So this post will be matched with our D appropriate ID.
I would the idea I get it and take the things with this variable.
It should be matched with this.
Right.
And also we need another one.
I have another field as a user and this user will be what this user will be our current user.
That is our current user.
If you want to declare it, I hope you remember it is as a request user, right?
That is our request user will be our current user.
Perfect.
So here I match both of these and I take the things with our this variable as they already liked.
So now after that I want to do want to check it.
That means I want to put on the condition if not already like that means this already.
Like sorry.
That mean this one if not already.
Like then what exactly is to be do then.
It be.
Actually I take another one, I take another variable as I liked, like I light like post and with this
like post I want to do with the like the position with just like the same.
With our lightless, I want to again take it that we set up our DNA, our post will be with our same
as a post.
Right.
And also our user user will be our request to do that.
That means our current user occupant.
So it'll be just like the same condition to this post, as I told you.
So there is a to fill in the post and the user search will be matched over this appropriate requested
ID user post and also our user will be our current user that ensued.
User is already logged in and after that, when it's natural to want to save it, that will save our
dislike like post and to save this data perfect and wonderful, we save and return.
That means here in our if condition here to return and return with our EDP response.
Make sure you add that EDP response to direct a considerate response.
Also, I don't want to take our EDP response to that.
We did that work.
If we go to our again view, it considers a glorious GDP response redirects and I wanted to use it.
So here I add our EDP responses and also I need another one.
I needed another one that will be as our diversity.
We need it.
Right.
So that is a reverse.
That is, you are an important resource also.
You have to add it.
So make sure you add that SCDP response, reverse redirect and also to take our reverse.
That is in our from that is from Django and then the Waddle's and from here on the input on the input
that reverse.
OK, that means that the reverse.
Right.
So now what to do on Texas, both of this.
So we this has to response.
I want to extend our this one that means here it should be as a response to that.
And here I want to do the parser diverse.
And with this reverse, I want to pass it to our sampas.
I want to want it to be like after that, like it to be the same home base.
So for the home, I have already created one of the equal.
If you go to our menu URL, you can say name it as a home right now and to do and to pass it.
So here is to be elected to our home, I hope is very much clear to friend what exactly the things I
did for our lightpost.
So now we have to do the same things.
I have to create another function for our unlike Israel would just like that same.
So if you already understand that condition, I think you should not be worried about it.
So that will be our other condition.
I name it as the I'm like, OK, name.
It is unlikely it should be the trickiest.
And also here we have to pass our the parameter as a primary key and then I want to do and to take on
the variable as the post and post will be without post model.
With our post model.
I want to get that objects, our objects will be get it should be match with our ID.
That means our field ID database will that it became that America will be match with our district requested
by key.
So here I pass it right.
And I just take the things with this variable.
So no we have to do, we have to take another variable.
I take another variable that already liked and here with the likes class.
I want to do want to get that object object to another then I want to filter it on the filter.
On the filter.
It will be as a post.
Our post will be our and this is the post that will take the things with this variable.
Right.
And also our user and user will be our current user.
That means our requested user, Redfearn.
So I hope it's very muscular too, because of, you know, like if you go to our room like that Missier,
you can see that the two are the post and the user.
So this post will be our D appropriate current and it should be matched.
That means when it will be matched with our distinguished Dyle, then I take that into this variable
and here I match it.
Right.
And then our user.
That means so our this user.
Right.
This user will be our current user.
That means our user is already logged in softer that before I save it's annoying to do and actually
deflected.
OK, that means when you unlock it automatically so we make it as a clean.
That means I want to direct our previous record data.
So with this already already like I want to do it.
So that is a direct method.
I declare it and after that I want to return, return and then with our EDP that so it to be responsive,
direct here I want to do in the past with the reverse and then it should be redirected to our home.
Right, same as a home base.
So now we have to do have to create a both of this that we have to create.
But this is what that means in are opposed.
If you go to our Apostille or else here I want to do and to create a tool of this you order.
So first of all, it will be I name it as a Leicht.
I like and also after that like that, I have one of the parameters have declared their perimeter is
a picture that means the primary right here.
Also, we have to do we have to add our speaker.
Right.
So make sure you add that idea.
And then in our view into the video, I have created all the function name as I liked switch will be
as a light and also named as a light.
And also I have to take another one for I like.
So it will be as I'm like, OK, I'll be as I liked.
And then also they'll have one of the primary key.
And then in our view, that is our primary primary key.
And then our view I have created one of the function name as I like, so it shall be as unliked and
I name it as a unelect.
So now I want to do I want to add one of the icons that means here I want to add on the icon.
I guess if you want to add that icon, I have already added our farfalle.
Like if you go to our business jemal that is our basis.
HTML like first of all, our home in our home, I have loaded what I have read that neverthought assimilate.
So now that is our neighbor, so do the neighbor area.
Yes.
You can see I have already include our eye contact in the form of some icon.
So now we can actually use it.
Our phone does some all the class.
Right.
So now I want to do that work so that no, I don't need this and go to our home and the home.
That is our profile.
That is our caption.
So after that caption, OK, after that caption, that means our post caption.
So that is a post caption.
After that, I want to do want to add one of the class.
So that means I have a class.
So that is our I sorry.
That will be his.
I write I and the idea I want to put on the class so our class will be as a fa fa I want to want to
use our hard work hard and I want to use it hard.
And also I want to add another one and another one is be as a fa fa hard or that is empty.
OK, that means this will be another class as or so.
If you start with the font or some icon you will get this type of on the class.
So I want to use it as a fa fa icon and then fa fa heart and as a zero.
OK, so now let's check this out.
If as I say well first of all, to check it, everything is on display or not because refresh.
Yes.
Now can see snow perfectly getting our FA icons.
So that is our fa fa hard and that is our fa fa hard or perfect.
So it's pretty simple, very small size, but I want to try to increase this size.
So if you want to increase this size like here, here on the bottom of this table, OK, put one of
these style and I want to do want to add on to the font, OK, font size.
I make that font size as a thirty six, I make it as a thirty six pixel.
And now let's check this out and also want to add the same for our or locally as the Savol.
And now if you refresh it.
Yes, you can see it's pretty much better.
Right, you can see this pretty much better.
So here actually now displayed both of this.
So I want to put on the condition and with this condition, when it'll be the light, then it be as
our second only visible that means are far, far harder will be visible.
And when it will be as I unlike then fa fa fa or will be visible.
So we can do that.
OK, I show you for doing this here.
So before display this condition.
First of all we have to get appropriate data.
That means which user already liked our which post.
Right.
So here also we have to get this data.
So that's the home that actually comes from our view and the view you can see that is our home, right.
That means in our app that means Apple.
There are views that our home function and indeed the home function area here.
We have to declare some of the things like, first of all, I show you, then everything will be more
clear to you.
Like here I take one of the variable as the light.
Sorry, here I take one of the variable as I liked and disliked.
I name it like both, OK, we dislike most and we don't like that because I like class and we dislike
classes to besame our I get our objects and I want to filter it ok.
I want to filter it and filter it with our user.
Our user will be which one.
Our user will be our request to do that.
That means our current user.
So that will be sorry.
That will be our current user.
Right.
And then I want to do, I want to actually find out our tissues that that means this current user,
like our which posts here, also have to get that information.
So far, the results I take another variable are the liked, OK, I name it as a liked and.
Mm.
I liked post and the list I.
To show all that, at least so with this, I want to do with a light that means we don't like fools,
I take our this I can't use a double take the things with this variable.
So with this, like post I want to do I want to add another function as a value list.
OK, so with this value list, we will get our list appropriate information.
So now I name it as a value list.
So with this value list, I want to show our all the things I want to show all the tower post.
That means this after all the post.
Right.
So now no.
And to do want to add that our relation name as a post and also to do and to make that as a float through
like a flat sorry flat will be as a true Silvy as a true perfect.
So here I take that or at least all the data and take the things with this variable as a like post that.
As for now, with this like post list, we get our appropriate which are actually like our hoogervorst.
Right.
So now I have to do I have to actually pass it.
I have to pass it in our home.
That is Tamalpais.
So now in our home dot after that post, after that post, I wanted to take another one which will be
easier like post.
And here I passed it in our dictionary area.
So now we can actually use it, we can use it in our home base.
That means our home got a stable base.
So now go to our home address still here.
So first of all, I don't want to put on the condition.
OK, so here I want to I take one of the if condition that we leave our right now.
I'm already in our for loop.
Right.
Uh, that is our follow.
So I get all the data we Darfor and also that have one of the primary keys or else we have to declare
it.
That means if OK, here, we have to write those E post as our picture with this speaker.
I want to in I want to in our what from our view, I have already passed over like all that user data
and I just pass it with our D variable.
That means there is a clause like post-flight that is a like post list.
So now on to do on the added.
So that will be our like post list.
So with this we can actually distinguish that part.
And also I take out there as ls that means used to be as ls ls is still we display another one and after
that I want to learn to finish it.
That means or and if I need everything will be much clearer to you.
So initial B as in this post that means if or this ID is already like there will be display one.
OK then if we display this one right then L2 still will display this one that there is a two condition,
AB declared.
So now if you click on the Savol because to save all the result, Dave, I protect you.
The save all again.
And now if you refresh it.
Yes.
Now go see that now is actually showing our one.
That means only one is visible.
Right.
So here I have to put that condition.
If this user already liked it then it should be displayed our ferhat else.
Shall we display our four zero now can see I didn't like this post but the is now showing the empty.
That means our fa fa hard.
All right.
So now to turn to put on the head if that means here on, to add on what they had if a hatif and into
the Ahari Fadia I want to pass out this icon.
I got it.
And here I pasted it.
OK, and also I want to add another Arief and also appear to have to finish it.
So I just put some of the link on here.
So I have already created two of this.
I have created the people in our post and the like and the and like.
So now to do an actual round both of these.
So that will be in our attempts that means here.
So I call that our all that will be as if you are ill.
And with this you are a little first of all, I don't want to load our apt name, our apt name, as
opposed to with this post.
I want to access our first of all, this will be as if I had that first of a little bit, unlike that
means here that is are like function.
I wrote name I want to do and declare it OK.
And also after that they have one of the ID also after that they have the ID as a paramedic e and also
you can say I've added this our ID, so now I'm do to add this idea.
So I will be, I name it as a picture and PCA will be our this post primary key.
OK, it'll be our this post Primerica.
So this is our, our the clarity that we have declared that things with the primary key.
So now this, our primary queue will be our this post ID, so that is are disposal ID.
So now I have to do the same things I copied and here I based it so it'll be our light.
That means I have created it as a light.
So now I copied and here I put it.
So this will be our post and like.
Pay Primerica will be our posters, primary key and then automatic release of the updated perfect's,
I have already created all that function right in our view.
I have created that like function.
And the result of that as a function to the viewer idea, I have already created both of this.
So there is a light function and it is are like function software and that's all you have to do.
Now let's check this out.
If everything OK now, it should be work if you're not as a sea.
And now, first of all, I want to check our server.
Yes.
Very specifically running.
And now I refresh it.
So right now, you can see there are all the posts and there is a blank, right?
I didn't like this post anymore and that is of the post and that is all the post is unliked.
So now I don't to like this post like there is or I'm outside outside the box and I do like this post
just like the Instagram.
Yes.
You can see friend now I have already like this post and for the results you can see it's not selected.
And also I like this post.
Yes.
You can see is also siliceous if you like it.
And I go here you can see again it's changed so far.
The results here have declared that part.
That is one should be unliked, one should be on like then it should be automatically deflected.
Our already liked all that post.
Right.
So now this is not elected and make things as empty.
So perfect if you like it.
Yes.
It's like if they liked and now it's perfectly light.
So I hope you enjoy it.
Very much so.
Now from here you can display your all that appropriate flowing user, all that post.
And also now you can like this post and I like this post.
Right.
I hope you enjoy it very much so.
Now we have to do you have to actually pack this.
OK, you have to back to Sweden when you pack this, you will if you get any issues, if you face any
problem, just let me know about it.
I will be always in touch.
So thanks for watching and I will see you in the next video.