Hello, friend.
Come back.
In our previous video, we successfully complete our profile pages and also from here you can update
your profile, all the details, information, right.
So now I want to do I want to work in our social media post.
That means I want to create Instagram, type up one of the social media projects so where users can
upload some of the images and where another image can like or dislike this post rather than.
And also, I want to add another function for the following.
This user are unfollowing this user so they step up one of the social media projects I want to create.
So for doing this, we have to do we have to create on the table.
Right.
So better if you do that.
Well, I think you already remember that, but that means we have to work in our post app and that is
our models.
So better I want to do and actually remove everything here.
We don't need it.
I remove everything.
First of all, I want to create our model table.
That means all that are postulated that we want to create.
OK, so that is our application name and that is all models into the model area.
First of all, we will need our user.
I have already agreed to complete our authentication.
So now, first of all, I want to do want to get our user class.
So that is in our form.
And then that Django right from the Django and then the country.
So then the country and then art and then the models.
So from the model, I want to import our user class.
That is our user.
So friend, I hope you already remember that part.
With this user we can actually access our user.
So now I want to do for our social media project.
First of all, I want to create on the table for the post.
That means what user can add some of the post, right.
For the regions I want to do and to create on the class and I just name it as a post.
And this post will be also inherited our models and then our model class.
I hope you already remember that part.
And then I want to do want to add some of the field.
So for this post, as I told you, some of the user can able to add some of the post for the reasons
here we have to add that altered, I think, namely that the OK name does auto or whatever you want.
So now I name it as the auto.
And then we thought this model.
I also want to declare one of the foreign key because I want to create one of the relation with our
TS user.
Right.
So if you want to do that work, it'll be just like the same before.
So with this model, I take one of the foreign key.
So it shall be as a foreign key, I take one of the foreign key and I want to create the tension with
our user model right now, I add that the user model and then also be just like the same as the on underscore
dialect that with this own dialect.
So it'll be just like the same with these models.
It'll be as a cascade, right.
It'll be a cascade.
That means whatever the field I want to post, you know, add in our post table when our this user will
be Dilek, this user elected, all that data will be selected.
So I name it as on Delek model as a cascade.
And also the person the name that means the relation name.
So if you want to display that religion name, it will be as a related related underscore name.
Right.
It'll be the related name and I name it as a name to the post.
OK, so it'll be as a post and then I take another field as email.
So that will be our filled with this model and then I will be as the image will type in field.
So it'll be as image will.
Right.
And also here we have to set our upload.
That means the upload underscore to what exactly will be uploaded, all that file being made one of
the folder as opposed Dimmeys.
That means all the postulated images will be saved, in particular this folder.
So you know our media into the media area.
I want to do want to create another folder and I name it as opposed to images.
That means all that our posts, related images will be saved in our media and then our post images folder.
Right.
And after that, I take another one for the image caption and name it as a caption.
So that's all that our actually field.
So I know I take another feel as a caption and with this model it will be as a character filled, it
will be as a character field.
And then also if you want to put some of the maximum length, you can add that maximum Lintott be the
maximum underscore length.
So maximum length will be a name that is 264.
And then I make it a blank as a true blank will be as a true I it as a blank will be the truth.
And then and also I want to do I want to add another field after our uploaded I name it as upload underscore
date.
OK, that is when this user actually uploaded this post.
So with this model this will be as a date pinfield that when the date and time field.
So they will be the date and field.
And also here, as I told you, to have another function as an auto sorry auto underscore.
Now underscore that message will be automatically created here.
You don't need to do anything when this user will be uploaded.
And he paused.
Then automatically we created this.
Did OK with our auto.
Now add that is all true.
I make it as a true and also I want to want to update it that I did it for the update, that it will
be with the models and also should be as a date field and I make it as an auto now, not the auto.
Now add it Silvy as it auto now.
Right, so this auto no want to make it also the true.
So in fundamental I have already discussed about everything.
I hope you will understand about it.
OK, so now if you also want to make that our post, that means the descending order is from the visible
lead.
So I have already declared discourse about the things we do.
So they have done the class I have to add.
Sorry.
So I want to add another class as a middle class because of all I have already created on the class.
I created another class inside this class.
So you have to make our middle class right.
So the middle class area I want to do I want to declare our already OK order.
Ordering our ordering will be as a descending order.
That was last post will be displayed as in our fast.
So if you want to get that our last post, we can get it with our upload.
It did so now with the upload a date, I want to make it as a minus.
That means it will be automatically so our last post in our fostoria.
So in our previous section I have already discussed about the things we do.
So now we are using it again in our post area.
OK, so I have created one of the class as a table as opposed to the post table.
I have created our altered images.
Caption That will be all that our feel right.
And also our this post will be showing as a descending order.
That means our last order will be displayed in our fast and also for our social media project, as I
told you.
So when this user will insert the post.
So this I want to go on to add that one of the like option, that means another user can like this post
or the D like this post.
So you actually connected with two terbil each will be connected with the user.
That means who each user like which post.
Right.
So here we have to also add some better.
First of all, I want to create all the.
Every class, so class will be animator's alike, look alike, and then all suits will be inherited,
our models and the model suits will be inherited both of these.
And then I want to do I want to take as a post.
First of all, post will be needed because of this result.
Which post actually he put that as a like.
So with this I want to create another relation with our post model.
So that will be a different key with our foreign key I want to do and to create the relation with our
post model.
So that will be our disposal model.
Right.
So here we are.
I just feel that that is our formula declared.
And then I want to do want to make that also the same as the only that is on the left and on the left
with these models.
It will be as a cascade, right.
That will be as a cascade.
And also put that related name related related name related name will be, I name it as a lightpost
like like underscore post.
Perfect.
And also we have to create that another relation with our user model.
So I take another variable as a user and with these models it should be a different key, right.
It will be a foreign key and foreign key without which model that is the user model and then the only
select and with these models and then the cascade.
So that will be the cascade and also put on the name.
That means our deselection name.
My name.
It is a related related name.
I name it as like OK, so whatever you want.
So now I make it as Oliker.
I hope Brand is very much clear to you because here this information will be needed.
Right, so which user actually like which post.
So here we have to add both of these Synnott previous block Bozic.
We did the same thing.
So that is considered the same concept.
I apply it for our this social media project and also to create one of the date that means a name it
as a date, created a date, created another field, be as a hidden field, as a date created.
And with these models it should be the date time field.
So that time field is to be automatically created one of the date.
That message will be as it auto right auto now and that message will be created will automatically date.
And I make it as a true.
And also if you display in your database that is which you are like which post.
So if you want to display that in our database area, I think you already remember that part so that
you can actually declare that function.
That is our extreme right.
With this string, we can actually make it as a self.
So that will be as a self right symbol to self radioland on the visible.
That means to return some of the data from here and return and return.
I want to pass two of this sound to pass our self user data and also pull data.
That means I want to visible that things in our admin area.
That means, as I told you before, into the admin area, if you want to visible that any kinds of details,
then you can display it with our self.
So don't want to pass two of this.
One will be one will be as our user.
And also I want to take another one, another one.
And also it will be as our post doc.
So here we have to add it.
That means that also another function as a format.
So with this format you can add it.
I show you whenever I need, everything will be much clearer to you.
So here I do unto you display our user and also the post.
So if you want to access that user or the post, you have to access it with the self.
Right.
So as told you before, that is all pretty basic, right?
That is our user.
And also in Texas, our post, that means with the self and with the self underdo and Texas outpost.
Perfect.
So that's all you have to do.
So here I want to do and to create another our table will be as alike like and it should be connected
with our post.
That is our post model and that is our user, that is our default user class.
Right.
And then I take another feel actually automatically created when this user actually like our this post
and then it should be displayed in our admin area.
That is in our administration.
We display which user I like, which post so username and our post will be visible.
So here I have created both of these and now also want to add another option for the following because
of all Instagram.
What exactly they have the conditions like in Instagram, they have the option for the following this
user.
And when you're following this user, then you can actually visible this user.
All that post right after that flowing, you can actually visible it.
So all in all, social media project, I also want to add this functionality.
So for doing this right now, work together, save all so that.
Is our post, and also, if you want to add that flooring that is directly connected with our user,
that means user will be floor another user, right.
So that is actually connected with our user.
So better in our app into this app blogging application area.
That is our models I have already created and the model that is our user profile.
So now I want to do want to create another class on another class for the following.
That means I get another I want to create another class and name it as a floor, OK, you name it to
the floor.
So friend, when I'm ultranet it then everything will be very clear to you.
So don't worry about it.
Just take that concept.
That is how it will be.
Annotate our models and the model right.
Will be just like the same which will be in our model and for the following year.
Also we have to do we have to create some of the foreign Q and here we have to connect it with our user
model.
Right.
So here I have already improved our user.
So now I want to do want to take one of the variable as a flaw.
OK, I take one of the variable of the floor.
And then with these models, our foreign key, we have to declare we have to create that relation with
our user model.
And then the same concept which will be on the left.
On the left will be our with our models, with these models, which will be as a cascade, that will
be as a cascade.
And also to some of the relation name that will be the related name.
Right.
That will be is related related name and put that name as a floor.
OK, I will be on the floor and also take another variable as a flowing.
That means which user actually flowing.
Which user.
That means I name it as a flowing which will be the flowing.
And then with these models I want to declare that foreign key.
I declare another foreign key and I want to create that relation with our user.
That means our user class.
And then it will be on the direct on underscore Delek on the left will be with our models and then the
cascade, which will be as a cascade, and also the ports on the related name redacted name for this
one.
I name it as a flowing OK, name it as a flowing perfect.
I hope friend is very much clear to you.
So that is our end of the class as a flowing.
So now I want to do if you look at the Savol.
So first of all and check that Sahlberg here is not showing some of the error in our forced into the
models, so do the post models.
That means here in Line-by-line 20-20 if you go and the model here, number twenty two here you can
see snowshoeing of the arrow.
You're still showing us the invalid Syntex.
That means you can see it'll be actually in one teched.
That means you still be the one to see the one together.
Yeah.
Here we have to add it.
I feel like you to save all.
Now let's check this out again.
Yeah.
You can see it's perfectly running.
That means that it's actually I make that easier with our Puttock and now it should be only one single
taking down one single.
Yeah.
I want to display our user.
Let me switch user actually like Witchboard.
OK, so that two of these that I actually display in our particular D to this area.
So that is our model and that is our app model and also that is our app locking model.
So now I want to do an actual register because of all in database.
If you want to visible it then you have to do you have to register it in our admin.
Right now I want to register.
That means in our app logging if you go to our admin.
So here I want to take both of these that we are from and from our app logging that will be app and
then logging from our app logging, then the models.
So from to the app logging modules I want to import so that Misener from app logging and that is our
model.
So from here I don't import our user profile.
I want to use our user profile and also I want to pick out this flaw like that is the flaw user.
So should be first of all you have to add it and also after that we have to register it.
So I think you already remember that part.
It will be as admin and then, you know, admin side.
We have to register, we have to register or both of these.
So here we have to register our user profile.
And also another one.
Another one will be our floor.
So I had both of this.
And also we have to do the same things.
We have to do the same things for our app.
And here I have to have this one is the post and is the like.
Right.
So now we have to also really started in our post and then our admin sued the admin area.
First of all, we have to import it.
That means from that will be our app underscore post.
Right.
The apples that elected the models, so from here on the ground to import our tool, this one will be
the first one will be the post plus.
And also there is another one I have created as a like.
Right.
So now I take both of this software that we have to do it.
That means admin and then side and the register site disaster.
And then here we have to pass our this class as a post.
And also there is another one which will be as a like class.
So I add that like plus so here I already started and I'm going to do I want to migrate it now if to
at this first of all, I want to check our server.
Yeah, everything is running well, they have Neudorf Sahnoun go to our end of the terminal here, but
I closed it.
I want to open a new one.
I opened a new one.
And here I want to run that.
I want to make it out of this.
I want to make this app locking this model.
And also that is another one, as you know what Apple is, right.
So first of all, I want to migrate our app logging.
So if you want to migrate it, that will be the pie.
And the man is not pie.
And that make migration's,
make migration's.
And then our name, our name will be as the app Logi right into the app logging.
That is our P and the managed by MK Migration's and that plugging so no one to do and the magnitude
of the enter.
Now, obviously, it's not created our this flowing that is actually our floor, so that will be created.
And after that, I want to turn to a magnet that means the and the man is not fired and then magnet.
So there will be as a PI menaced by the Maigret and clickers enter.
Now, see, Snow successfully created our this flow, that means this that is a clever migration file,
right.
And also to do and to run our act, another one.
That is another one as opposed to that post to the model area.
I have also created two of these are the pools and the like.
Right.
So now what to do?
I also want to make the decision to magnet.
That will be sorry.
So you want to migrate then?
We have to run the same comment again as a pie.
And the man is not pie and the make migrations OK, they have noise is actually the make migrations
and then I want to do that is will be our app underscore post.
Right.
So that will be our app.
So no I want to enter.
Now is still perfectly clear to of this model, one is opposed to, another is alike, so no one to
turn to migrated again and the pie and the pie and the magnet and knuckleballers enter.
So here, consider the spelling mistake as a magnet, so by and the man is not by and magnet, so it
will be as a magnet to enter.
Now, Casey is not successfully created our initialise all that fun, so we successfully migrate out
of this database table, one is our models that are posed and the likes, another one I have created
as a user profile on the floor.
Perfect.
So now if you want to check it, like here, I click the save all and I'll go down to redacted to our
admin so that I am already logging with the user.
But I click the log out and now I'm logging without user admin so that your administration name as Amjad
and the password you demanded for five no click is a login.
And here you can see friend.
Now I have created two of this class in our app Logging as a flaw and our user profile.
Right.
So now everything will be more clear to you.
So that is our app logging if you go to our app logging modules.
So I have created as a user profile underfloor.
You can see it's showing the flaws and that our user profile and also in our post in the Post, I have
created another two of this.
So if you go to our outpost, I have created another tool of this table.
One will be as opposed to another is the like.
So you can see snowshoeing as our likes and there is our post.
So that is our floor and the floor.
If open that we insist consistent showing as a huge user actually follow our which is OK.
So that is a clear floor and the flowing.
So for the floor here I have declared that part.
That means here, if you go now, everything will be more clear to you can see I have created that foreign
key without user class.
With this user, we can actually access it.
Right.
So you can see now perfectly getting all that user and also perfectly getting all that our user.
And also there is another one, another one as a user profiles into the user profile, it consists of
doing as a user profile object that to so that is our user is visible, the profile picture, the data
database, the website, and there is a Facebook field.
So all the field is now visible.
Right.
And there is also another one and that is actually another one as a one.
So you can see I have already admitted that the user as Karzai so far the Karzai I have updated that
the top part website and the Facebook, our everything is perfectly updated.
Great.
Right.
And then also, if you go to our home, that is our likes for the likes.
If you open it, you can see something showing create that relation with our post.
And the user writes, which user already user post will be visible right now?
I didn't create any post automatically.
It'll be display all the top post and also it will be displayed all the user.
So if you go to our likes, so that is, you know, likes I have created that relation, the post and
the user that we switchboard's that with this user portal like our hoogervorst so automatically is to
be getting all the data I hope is very much clear to you and also that they are post data.
If you want to add, you can see this will be, first of all, ultimately get our auto data and then
the images and this image caption.
So that is our filename.
So here you can see I added our auto images and the caption, so everything is visible.
I hope you enjoyed it very much.
So you successfully created all the table and also migrated and now everything is visible in our database
area.
So now I want to do I want to work out these post options.
That means if this user want to add on the post, how can I add this post?
In our next video, I will show you that things with a live example.
So thanks for watching.
I will see you in the next video.