Hello, friend will come back in a previous video, we successfully display our message, right, so
now I want to do want to work for our product model.
So for doing this, we have to do we have to go to our own project.
That means here.
So that is our product model.
And to create for our e-commerce site in our app shop, that is our application into the application.
That is our model.
OK, so you do this model idea what to do and to create two of this class.
One will be for our category and also we need our product.
So first of all, I want to do want to create one of the class for our category.
So here at the front of the class and then I name it as a category.
OK, I just name it as a category.
And also, shall we inherited our model, that is the models and the model.
So is simply the front of the model.
OK.
And after that, we have to do we have to define our field.
And that is our field name for the category I define as a title.
So the name, the the title.
And then it shall be with the models.
So with this model it will be as a character field.
So should we as a character field.
Right.
And then also here I want to define some of the maximum length of that tribute as a maximum that is
our maximum underscored length.
So that simply defines the maximum length, maximum length I want to define as a party.
OK, and also I define our one of the time that means here I define the creative time.
So I just simply defined as a created OK created.
And these models, it will be as a date time field.
So it will be as adept and filled and also for the daytime feel here, which will be as it turned out,
so I just simply defended ought to now add and make the things as a true.
So I just simply defend the truth.
I think you already knew about it so that all the time failed.
And here I defended the auto ad that was usually automatically generated that time.
Right.
So now I also make the things that are true.
And also after that I want to define our restraint so our esteem function on the line extreme and then
here will be as a self.
So same procedure we have to actually follow.
OK, so that is ourselves and it is a self area.
I want to return and to return our title that we with ourselves, with the self and return the title.
And also here, if you want to define this step of one of the things like when you create any class,
that means any table automatically you can see Snow added one of the is that I have created of the class
as a profile, but in database automatically added another one as it is for the user.
You can see Snow added that.
So if you want to prevent it, then you can also prevent it.
They have also the function for this one I show you like here I define that as a class class matter.
So with this middle class here, we have to define the function as a verb was like a verb was under
its name, underscore plural because he's automatically created on the plural.
Right.
So now I understand defining it as a catagories.
So right now it shall be added.
Make the things that it's just Kadugli, not the categories.
OK, so I just simply find that things with this function as a verb, both names, plural, no one else
wanted one to create another class for our product.
So it's very much important for our e-commerce site, you name it as a product.
OK, just name it as a product and also still be with our models and that our model is still we inherited
our models and the model perfect.
Now we have to do we have to define all that our field.
So first of all, I want to define our film as a Ommaney miss, because he will be so important, I
believe one of the main images and one of the main images is will be in our models.
It will be as a type, will be as the images will type.
So I just simply finish the images field.
And here also we have to define our upload what exactly should be applauded.
So I just simply applaud, underscore to upload to our to do and to create one of the folder name as
a product.
OK, so that is the product.
So there is a product folder we have to do.
We have to create it.
Our media in the media area, I have created another folder as a product, a good friend.
That is all that our product related emails will be saved, in particular that folder area and now also
undertake another one has a name that is our product name with this model.
So this model's here should be the character field.
So it should be as a character field.
And also here I define the maximum length.
So there is a maximum length for this name.
I want to define character limit as it 264 and also we need our categories because of all for every
product.
We have to select some of the specific categories.
So here we have to define all of the foreign key for this category.
So now I just name it as a category.
And then with these models here, we have to define our foreign key.
Foreign key will be our this category class, so here I just simply defined this category and also here
we have to define as a on the elect, on underscore dialect.
So on the left will be along with our models.
And then this will be the cascade that means in this category will be elected, this category product
will be also directed.
OK.
So here I defines the Cascade and also I define that name that is on the relation name as a related.
Related underscore name, a related name will be as a category, whatever he wants right now, I'm just
simplifying that name as a category and also undertake another field for our preview, tax preview,
underscore text.
And then here it shall be as our text field type text field.
So it's obvious the text field and also here define the maximum length and for the maximum length here
defined of the 200 200 character.
And also here I want to define the level.
So if you want to display that level, I think you already know about it.
They have also of the attributes as a verb was named Soheir Defender, Vivus name.
So the father's name is, to be sure, some of the lower level as a preview text.
OK, so this step up on the verbal name, which the display and also need our details text so I that
the details underscore text with these models.
So this model is that we also have the TextField sorry text field and also here we have to define our
maximum length.
So I just simply defined the maximum length.
And for this one I define as a one.
OK, because the description will be a little bit excises.
And also here I defended Obama's name and here Obama's name will be as a description.
And then our prize surprise is also important for these wonderful models.
And then it should be as a floor, another type as a flawed field.
OK, just simply defined as a flawed field.
And then another field I want to take as the old price all underscore sorry, all that this prize and
this will be as a models and with these models also should be as a flawed.
OK, so shall we also have the float field?
And here I define some of the default value.
OK, to simply define the default value as a zero point zero zero step up on the default value and define.
And also that date will be needed so that simply funds are created, created.
And for this created here will be the models and then the day time.
So that will be the date time field.
And also I make the things as an auto now add and make the things that are true.
OK, I just simply defined the true.
Perfect.
So I hope he can learn a lesson about it, so here for our product plus I have defined some of the field
as a main Ismay's name category preview, texte Delta X, XPrize, all prize uncreated.
So if you want to add multiple field, you can also defining it.
I think conceptually with a just like the same right now, stuck with me and now also defended the team.
So that is our stream and also salvias itself.
Right.
And here I want to do and return return and the self and here and return whatever he wants right now
and would want to return our name.
So I just simply defined that name.
OK, and also I want to make that our product will be as a descending order for the reasons here in
our class.
We have to define that metal right into the metro area here.
I want to do and define as a ordering site.
I have already discussed about the things we do with this product.
Will we get the data from our database by the descending order?
That is the last one will be as fast.
So here I have to do I have to get the things without this create a date.
So that was it.
We get all the data.
So here you have to define as a minus.
OK, and then is the comma perfect?
So now we have to do we have to migrate it.
Right.
So we have to migrate out this category and the product Nola's to that work.
I just click as I say Voll OK, just click the save all.
So now I just close it and now open our terminal.
And now here I define as a pie and that manager pie and then make Migration's migration's and then I
want to make our app undiscussable, so I just simply defend his app shop.
There is a pie managed by MK Migration's an app shop to enter and now here showing you are trying to
change that nullable.
Feel for the address one.
So there is this one actually, and that is if you go to our app logging into the app blocking, there
is all models seem to the model area.
I have defined that our length.
That means blank.
I define address.
That is a maximum level that they define as a blank.
True.
OK, so here but I don't want to make that all the feel as a nullable that means are now so here defined
as of now and here are defined now will be as true.
And then also I don't want to add this for every field to every field.
I want to define the now OK now true.
This will be the null.
True.
And also I defended the null.
True.
So here I define it a natural, now I just click at the Save All.
And now let's check this out.
I want to turn to enter again and hear a as a one, but I just close it, close it and run it again.
So here I just simply Savol and now able to run our migration again by and then Mannis dot by and let
me migration's.
Migrations and then I have to do have redefined our app underscores shop right to know, I just simply
have to enter.
Yeah, you can see snow perfectly getting that our of this table, that is I have created as a category
and another is a product.
OK, so here is getting that things for our discipled.
I have to do I have to defend that as an animal, then it's a little better actually.
So now it's OK.
So now I just simply remove it.
So now I have to work out where this model that is our category and also have created another one of
the product.
So now I have to do Intermagnetics.
After that I defended the by and managed by and that makes it look like the enter.
Yeah, now so successful, successfully magnet all that our data was stable, so now I have to do on
to run our server so pie and the manager pie and then run server.
And server, and after that, we have to do we have to also study.
That means they start to have this model, right?
That means here in our app shop or to that admin and the admin area, we have to do we have to register
it.
So now, first of all, we have to define our path.
That means our form, our app, underscore shop.
So from the shop area, that is our models.
Right, that the models from here and want to import our Kadugli category and also the product that
friend.
So that is our app shop and that is our model.
So into this models, I have created two of these as a category and the product.
So now I just simply define two of these.
And also after that we have to do we have to register it.
So here it is for the admin and then site and the register.
So register as our category and also on the on the register, another one as admin and inside the register
and then our another one as a product.
So just simply define that product.
Perfect.
So now if you click as the save all the save all.
Check this out.
Everything is running will now go to our database, that means here, refresh it.
Now, go to our home base, yeah, you can see it's now perfectly added our category and our product.
So if you go to that category, it is a category that I have defined that one field as a title.
Right.
And that will be automatically created.
And also that is our product.
So if you go to that ad product, you can see that is actually our email's function that we our mainly
and that is our name.
That is our category.
So that is our category will be automatically loaded on here for the reasons here I have created on
the warranty.
Right.
So that is our category will be loaded in particular that area.
And here defined as a preview text, the description price and all price perfect.
That piece will successfully migrate our database table.
So here I have created two of this table.
So that is our model into this model.
I have created the category and the product.
So now we have to do we have to visibly deprince here.
We have to do we have to create one of the BU for this one.
So but I don't want to continue this process.
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.