Hello, friend.
Welcome back.
In a previous video, we have created one of the middle class as a car model class, and here I have
defined all the Darfield right and also here a defense on the function, and that is our total function.
So here with this, we can actually calculated that data.
So now on to do want to create another class.
So here are two defining of the class as a class order.
And here we need our models and the model.
Right.
So don't want to do and define all the fields.
So here I will still be, as I name it, as an order item.
So order items.
OK, so the disorder's items, this will be defined with our models and also it will be as a many to
many relationship because of all customer can add multiple product.
Right.
So Austinmer can add multiple products.
So these are all multiple product we have to define in our criteria.
And also one order can add that multiple car data.
So for the reasons here, you have to do have to defining it with our many too many.
So just simply defined as many.
OK, Manitoban field, so I just simply defended the Manitoban Ifield, so many too many issues will
be with our which one is will be with our diskless as a card.
So here I just simply defined that card.
Right.
So it would be one of the religion as a management relation.
I just simply defining it.
And also here we need our users.
So will this user will create an ID card automatically will be created on the order.
That means one of the order in particular, that order class area.
So far, the results here are defined as the user.
So it'll be just like the same with our models already, with our models, and it'll be the foreign
key we have to call our foreign key will be in our setting.
So that means the settings and then AWT and then also we have to define that only elect.
So on the left will be with our models and then the cascade.
Right.
That means the cascade.
And also here we have to define the order.
That means our total order.
I want to take.
So you just simply defined as ordered, ordered and under the auditoria we have to define our condition.
That means here I want to make the things of the bullet so it will be a little new.
So we actually need it for our code base.
So now I just simply defining it as a boolean fails to actually show you into the amount of funding,
then everything will be very much clear to you.
OK, so right now I just simply defined the order and the models with this model.
I define the type as a boolean type and here I make that things as a default.
False.
OK, just make the default false.
So that means when our any packages that we use are will any product.
So that is actually purchased.
I have defined as a false right.
That means one still will be as a true.
That means this purchase is complete and then it will be like a door ordered area and the order area
by default.
I make the things that are false.
So when this user will complete this our order portion with the payment, then our dysfunction, that
means this default will all be updated as a true OK, so we don't have to be the true.
That means this order is totally completed.
So here I just make that a default and also we need our created.
So that is a created.
And here with these models, it will be as a date time.
So here I just simply defending the date time field and it shall be as auto, right.
That means that auto now add and make as a true.
So just simply defined as a true and then our payment idea also be needed.
So I just simply defined as a payment, like a payment ID.
And with this payment I do we can actually define our orders.
So for the reasons here, I define with the payment, I will be as with our models, who will be the
character field.
OK, so we have the character field and here I define the maximum length, so maximum length will be
either 254.
OK, sorry.
So just simply defined as the 264.
And then on to do I have to make that as a blank.
Blank will be a true and also I make the things as of now.
So now it will be as a true set the simply defining it.
And also we need our order I.D. So I just simply define our order I.D..
So with this order, I.D. will be also the models and the models such as the character field.
So character field here that defines the maximum length maximum limit for our disorder at the front
of the two hundred and then make that as a blank blank will be as a true.
And then also I make as a noun now as a true.
OK, I just simply defending the true.
That means so in our party it is complete when our total order is not complete.
And also here you can see that now we have to do we have to actually find out our total amount.
That means just six thousand and that our item to our total quantity prize are the two thousand.
Right.
So now we have to do have to define another things for getting our total amount.
That means, shall we define our total and total amount will be as a two thousand and six hundred.
That means that.
Twenty six hundred.
Right.
So here we have to defining it.
So now if you want to get this total amount, then we have to do we have to actually add on the loop.
Right.
Because first of all, it's a looping that data and take that out this amount.
And after that it should loop again for get out this amount for the reasons I wanted to take on either
one of the function.
So I just am grateful that Dave and name it as a gate and Resko totals.
OK, I just name it as a gate underscore totals and here I am to do it to defend itself.
So it shall be as.
Myself and then here I define our total amount will be studied from zero.
So I just simply defended the total will be as a zero.
And then I want to do how to define one of the four, which that means for Loop.
I just simply want to for an hour order underscore item.
So our order item in and then here we have to defend ourselves and would be self.
I define our order items.
OK, I just name it as the order items, so I just simply define our order items all the time.
So that is our order items.
All right.
So now here we have to do we have to define our calculate.
That means our total amount.
So just improve on the total blousy equal to and they just make the thousands of flot.
OK, just make as a flawed and it shall be added our this loop without this order item.
So this order item and here it will be get our D total.
That means that the total amount.
Right.
Because here as I told you so we looping our first of all these items that are that means total amount
and then our second item data and then shall we get our total amount.
So for the regions here, I have defined this condition.
That means here I have defined the function as a total.
So here we have to do we have to add our D total Lightford.
So here I just simply add it.
And after that I want to do and define the return and return our total.
So I just simply define our D total amount.
So that is our total perfect.
So now whatever we purchase or whatever we purchase from Jakarta.
So when we actually make that order compete, then we have to complete it with our total amount.
Right.
What regions here?
I have defined our total amount with our totals.
So I think it's now very clear to use in I want to do I want to migrate it because here we have to migrate
out of this table.
That means our order and our card.
Right.
So now let's do that work.
I just have to save all.
And now here I want to do you can see there's also some of the error.
So that is our unexpected or total now.
So that is our you can see I defined as the auto.
So that will be as auto.
And then now and then our true.
OK, and I want to just clear the table again, so better in our view into the video and to make the
changes that need to be lowered, I can actually talk here, but I disclose it.
OK, just disclose it and run this over again as a pie and then manage the pie and then run server because
they enter.
Yeah, you can see snow perfectly running, so now I to turn to magnets or here, so here I just click
the save all.
Yeah, everything is running well, so no one to make it better in the closet and now open up time,
you know, so no one to make it out is to have this model.
That means here I have created as a water and also I have created another one in the cart.
So you have to migrate it like they did.
And I think you already know about it.
You have to define as a buy and then buy and then and then make migration's
make migration's and our app name, our app name as app underscore order.
So just simply define our apple because of all that is our application name.
That is our airport.
Right.
So now I just click enter so you can see is a spelling mistake.
So here we have to define as a pie and then manners dot pie and that make migration's and then app underscore
order not click enter.
Yeah, you can see now it's perfectly getting created out of this model that is are one of the cars.
Another is our order.
So no one do I want to migrate it.
So by and then managed up by and then migrate.
So to simplify it by madness by and the magnetic liquors enter.
Yeah, you can successfully initialize all that our table.
So now if you want to visit, we have to do we have to visibility Nawaat admin, so that is in our app.
Go to the admin party.
And here, first of all, we have to input both of these.
So from our app, that is our app order.
Right.
So from our app orders that the models so from our app orders and other modules and here we have created
to have this class.
So here we have to import.
So import our card.
And also I have created an order.
Right.
So I just simply import most of this so I don't have to do have to register it.
So you don't add admin and then the site and then our register and with the register area we have to
add our cart.
So I just simply the card and also in our admin side and the register and here we have to do have to
add our order.
So I just simply defied that order.
So now if you click on this all, I just clicked to save all and go to our server.
That means our back in the refresh.
So I didn't dinosauria, maybe.
Yeah, I wouldn't want to support the pie and by and then run server enter.
Our service is now running and now I just do it again.
Yeah, you can see now we have also added in our app order, that is our card and that is our order,
right.
So that is our order position and also that is our card position.
Perfect.
So now I have to do I have to add these products.
So I have to add this product in our card area.
So first of all, we have to set up it.
And when this product will be added and then it should be added our this product in our card area and
also in our order area so we can do that work.
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.