Hello, friend, welcome back.
In a previous video, we successfully set up our all that file, right?
So that is all that file set up in our setting.
And also we have created some of the folder as a media is static and the template.
And also we have inputted in our waste area.
And also I created two of these applications.
One is the Our Eye blog application.
Another is the app logging application.
So I want to do all that blog related.
Everything will be serving out this blog application area and authentication related to everything I
want to save in our app logging application area.
OK, so here they have also the models, right?
So right now I want to do want to work with our these models that I want to create some of the database
table and also add on to our sense of the database table field.
So if you want to working with the database, then you have to work into the model area, right into
the model area.
First of all, that is our default authentication system into the default authentication system that
have all the class as the user.
So first of all, I want to do and actually imported.
So that is from our from and then in the jungle and then the country and for the country.
That is an old and sorry, that will be the old and from the all the original models and for the models.
I don't want to import one of the class as a user class.
So if you actually sarg that in Django official website, if you go to the Django official website and
start with the using Django authentication system.
So this Django syndication system provided one of the user object.
So with this user object, you will get as the default field.
That is a username and password field, email field, false name field and the last name field.
So with this user, automatically you will get this.
You can actually access all that field for the reasons here.
I just simply import it.
Right.
So right now with this user, we can actually access all that feels right now to do.
I want to create one of the class and appear on the class and I just name it as a user profile.
OK, just name it as a user profile and also use will be inherited it all models and then the model.
I just simply add both of these.
And now here I want to do as I told you with this user, you can actually access our tea at these five
of these field.
And right now, if you want to add another additional field, also, you can add it so better.
I show you right now, like for that our user profile.
I want to add another I want a stable field as a profile picture.
OK, so I just named one of the filename will be as a profile profile underscore picture.
So I just simply name it.
And this picture that means that will be as it may step.
Right.
So with these models I just simply added our type and our type will be as the image field.
So it will be as the image will type.
And what exactly our this image will be uploaded.
Also here we have to set it in fundamental.
I have already discussed about the things we do.
So here it would be as a upload to upload underscore to an upload to our folder location.
So I want to do and to create the folder as a profile piece, profile, underscore piece of pieces that
are sort of better.
So all that our profile picture I want to save in our media into the media folder area.
I want to create all the new folder and I just name it as a profile pieces.
OK, so that means here every profile, every picture will be saved, in particular that folder area.
So I just simply add it.
And also there is a user and I want to create one of the relation with our user.
So right now, because of all here with this, we access our these five of these feel.
Right.
So no, I want to create on the relationship, but I want to take one of the variable as a user.
And then with these models, I want to create one of the one to one relation.
So literally, I will show you why I'm actually using it as a one to one on one bonfield, one to unfilial.
Listen, I want to create one to one relation with all this user.
OK, that means this user.
Plus I just simply add it.
Right.
And also I want to add all the relation name.
If you want to literally access it, then you can access it with the selected name.
So here I just simply added as a related like a related underscore name and with the selected name,
I want to put that name.
It will be whatever he wants.
Right now, I name it as a user underscore profile.
So this step of one of the name and also here I want to do on the set as is on the left, that means
to on underscore Dilek.
So on the left with these models, they have also of the function as a cascade.
So I just simply added as a cascade that means when our this user.
We know what the issues are, will be the issues are related, every profile images also with elected.
OK, so for the reasons here, I just simply added on the leg model as a cascade.
That means our I guess I have added another additional field as a profile picture.
That means with this user will access five of these field in this user will be deleted automatically.
This user related profile images also will be elected.
OK, so now we are ready to migrate it like here I have created one and then, you know, logging into
the logging that is our models.
So here I have created the class and I just named the class as a user profile.
Right.
So right now on to the end because I save all and here and that is our main project, victory.
So that is our positive criticism.
My Block project.
Right.
So here I want to do to make it so fun to migrated.
First of all, you have to write down a python or python or whatever you want.
So now I make it as a pie and the madness pie, madness pie.
And then I want to do to make it fast.
So in fundamental, I have already discussed about the things we do friends.
So when you actually migrated, they have the by default, some of the database as a school like database
automatically should be created on the school's database.
And here lately also we have to do we have to create one of the super admin.
Right.
So now I just simply added as a PI menaced by and the magnet click as they enter.
Sorry, here I just click the enter.
Yeah, you can see that is all the default database table, everything is done, successfully installed,
right?
So everything is installed here.
You can see that is our DB skylight is also added like the one here.
And also after that, I want to turn to Mike with our this specific class.
That means I have created the class.
So right now I have to do here, if you want to do that, work with the PI and the man is start by and
then make migration's, make migration's and then our opinion.
So right now they have the two app.
Right.
One is the app logging and that is our Adblock.
So I want to update our that because I want to migrate our specific this app logging these models.
So here I can just name it as the app logging app is called logging.
OK, that means the Pieman is pie and make migration's or app logging.
So if you click enter now you can see snow automatically showing our created model in our user profile.
That fits into the migration idea automatically.
So we created our this file.
Right, so I don't want to do I want to migrate it again.
That means the path I so here it will be as a pie and then managed by and that migrate so that it will
be as a migrate click as they enter.
Yeah, you can see our migration is not successfully done, so now I want to do want to create another
database table for our block that means our app blocks to go to our blog, and that is our Adblock model.
So do the modern media.
Also here, we need our user for the reasons here.
First of all, I want to input our user that is our from and then Django and then the country country
and then all and then models from here.
I want to do untampered.
I want to input our user class.
Right.
So first of all, I just simply added and now I want to do and to create on the plus.
I just named that class as a blog.
OK, so whatever he wants right now, I make that as a blog and all six will be inherited our model
and then our model.
Right.
So that is our model plus.
And now here for our blog, I want to do I want to assign some of the field and into the blog area.
We need that auto right.
So first of all, I take all of the field.
It shall be as Ozturk.
So that is all talk OK, which will be as an author.
And then with these models, with these models here, I want to declare one of the Franchi because of
all here.
We have to also create that relation with our this user.
Right.
So from here we'll get our user name.
You can see we will get that username, that password email field and the first thing.
And so right now we will want to access that user name for the reasons here.
I want to do I want to added our this user.
So with this author Model S to declare the foreign key.
So I just simply added as a foreign key and foreign key, without which glass Franchi our unadaptable
as a user.
OK, so I just simply added and also will be as their own dialect.
So it'll be just like the same as it on dialect and then models.
So with these models, it will be as a function of the cascade.
So it will be as a cascade.
So that means whatever the field I want to assign for our this blog automatically when this author will
be elected, these auto related everything that means here might be some of the blog title, blog images,
everything will be re-elected, OK.
So far the year here I make it as a only like models and the cascade and also the relation name.
So if the relation name it will be as a related.
So that will be related and related name.
I want to do I to make as a post author.
OK, first underscore author.
So just name it as a related name as opposed to particularly we'll use it and then everything will be
more clear to you.
So that is our author and also for the blog.
I want to assign some of the database that will feel this will be as a blog title blog under title.
I just take one of the variables and this blog title area with these models is to be as a character
filtrate.
So I just simply added as a character.
So I just simply added as a character feel and then for this character, I feel I also want to assign
some of the maximum length so it will be just maximum and the length maximum length for this.
I just simply added as a 264.
OK, and then also there is another thing I want to do, and I want to add that Vamos Vamos is just
like as a placeholder.
So I just simply am mad as a Barbas name and Barbas name will be as whatever he wants.
And now I just put as a boot.
Sorry, put a title.
Would the title so that will be, as I told you, Barbara's name is like as a placeholder.
So our placeholder text will be as a pooter title.
OK, and then I want to to take another one as a slag, slag and slag is very much important.
One of the part.
So here I also want to add it with this model for the slag that have also another field type as a slag
field.
So I just simply add as a slag slag and then field.
So that will be at the slag field and for the slack field.
I also add that maximum length, maximum length for this other two, 64, and then I make that as a
unique OK, that means this will be as a unique and unique.
I make it as a tool.
So that will be as a true.
And slag, as I told you, is very much important.
One of the things like if you go to if you go to that, you do me.
And would you do me here, you can see that some of the course and for the every cause, that is actually
the title, right.
But if you open it, if you open this course, then you can see that it's actually the our wall is just
like our title.
That means it's actually getting our this title as you are.
So that is actually the slack.
OK, so here I also want to do that type of work.
One of the things we will put in our blog title area, our slack will be automatically that means our
you will be with our this title.
OK, so one of the things we will put in our title area, our referral will be in our title.
That means it will be just like that.
That is actually our title here.
You can see that there you are also that is our total title is not visible on here.
So that is actually the slack.
So it's very much import and it's very much also very much as your friend, you are the real stuff here.
If you want to create this type of bomb that is your friendly Warrell, then you can set up it with
this like look, for the reasons I just simply added as a slag.
And with these models, our type will be as it's like field type and maximum length, and then it will
be as unique because of all this, like also should be as unique.
Right.
And then it will be conflict.
So here, for the reasons I just make it as a unique, as a true, that means our dislike will be added
to discuss about that later.
Everything will be more clear to you.
And also for our blog, I want to add another feel for the blog.
We need another blog, contain blog emails.
Right.
So I take another feel as a blog, contain, underscore, contain, some blog, contain.
And here with these models, this blog content type will be the large amount of the text for the reasons
they have done that type as a TextField field text field type.
And for this text will type.
I will here.
I want to do want to use that or these Barbas name says a verbose name, as I told you, is just like
as one of the placeholder.
So you should be sure that placeholder as a what is on your mind.
So this type of of the text that is placeholder text, which will be visible.
OK, different.
And then also for our blog, I want to add another field as an image that means our blog emails.
And then with this model, this will be as the emails will type sorry emails field.
So it will be as emails field type and what exactly will be uploaded.
So here also you have to do you have to add that as they upload to upload to where I want to, I want
to create another folder as a blog, emails, blog, underscore emails because of this type of one of
the folder I want to do and to create a better I named as images the block images I just simply copied
in our media.
I just created one of the folder and name it as a block images that means are all the block related
emails will be serving our particular D folder area.
OK, and here also if you want to visible the placeholder, you can be it with this verbose name better.
I name it, I name it as a Vivus by name or verbose name will be as the emails are blogging this blog
emails.
Right.
So I just simply added and then I we need our published did and the update did I just take all the variable
as a published it published under Article Date and published.
It will be with these models and they have also another that is active all the time feel right.
So this will be as another type as a daytime field.
So the date and then the time, the time and field.
So with this daytime feel, I want to do I want to add another option to have another option as the
auto now add.
So that is actually all the default on friend.
You have to actually remember it.
So that is auto underscore now and then add and I make that auto now add as a true.
So here we need to actually create this block automatically will be created one of the dead.
And I just make that things as a true.
That means you cannot actually change it automatically.
Still be get your current date and this current date will still be created on the current bit on here.
That will be our published it and also to take another one as an update, that update underscore date.
And also with this model, this will be the same as a date time field and in the daytime feel they have
another option as auto now sorry auto underscore now.
So with this auto no, I want to also make the things as a true OK, make that things as a true.
That means when this blog, when you want to see if you want to read this blog, when you update this
blog automatically will be updated that date.
So they have.
Often, as it turns now, that is when this block will be updated, automatically admitted that will
be updated for the reasons here.
I make that as a true friend.
And here if you want to display our esteemed representation.
So here if you want to do that.
Well, in fundamental, I have already discussed about the things we do, the reality star and then
and underline and then the self.
Right.
So so we actually show that we use data in our database field area.
So it should be displayed.
So here I just simply added as a return, OK, return and return which field you want to display.
I want to make the things that a self serving or I want to show our blog title shall be displayed in
our blog title area.
So perfect.
So here I have created two of this.
One is our user profile, plus another for our blog into the blog model here for the blog.
I have added some of the feel as an author, blog, title, slag blog, contain Bloche Maze published
dead and updated suffering for a purpose.
I am actually using this type of on the fields.
If you want to add multiple fields, you can add it.
But if you understand that main concept, then you can do whatever you want.
And also for the blog, we need that the comments option, the like options.
Right.
So better to do than to continue this process, you know.
Next video, I will create another two of this class for our blog as a comments and the likes so we
can do that work.
In our next video, I will show that things with a live example.
So thanks for watching and I will see you in the next video.