Hello, friend, we'll come back in our previous video we have successfully created to this class that
is our card and our orders, and after that we migrated, right.
So now I want to do I want to work for this item.
That means here, if you want to add this product in our category, also, how can I add this product
into the kind of scenario in this video?
I will create it.
So for doing this, we have to do we have to work in our airports are into the airport, our the area.
OK, so into the viewfinder area.
First of all, I want to do want to add some of the building function like into the render.
So after the.
I want to also get another function that is our gate and then object so that it will get object or four
zero four.
That means if you didn't get sorry, still the four zero four.
So that means with this function I want to define when you re not getting any object, then this will
be displayed as a four zero four.
OK, so I just simply defined that function.
That is one of the building function that is our get object R and the formula for and also I define
the deck, OK.
I also define another function as a redirect and also we have to do we have to define another layer
that is clogging the grid.
So that is our triangle into the Django.
There is a country.
Right.
And I think now we should be clear to you, because as I told you, everything is a building.
So that is our logging record that is in our Django country board and the decorator's so from the decorator's
sound to import our logging, logging underscore reoccurred.
So that is all looking good, right?
And also we have to do we have to add our model so our model, in order from into the app and the app
order through to the app order, I have created our models.
So here we have to import our model as a card and also our order.
So just simply define both of this.
Redfearn and also if you want to display that message that we saw in this product will be successful.
Legard Then I want to display that masses for the masses.
I have already discussed about the things we do that have also on the class as in messages.
So that is in our form and at the jungle, the country by country.
And from here I want to import I want to import our messages.
So better on the person of the note for you.
So this will be for our messages.
There will be foreign messages.
That's actually for our model.
Look, that will be for our model.
Perfect.
And that will be as a lagging indicator, which we have used a lot of the time.
And then the really dark and the render perfect, not one to do and to create one of the functions.
So this function will be also as a logging ticket.
So I just simply defining with all these that they are locking the occurred and then I define the function
name and I just name it as an add to cart.
OK, add to cart.
So here we have to do have the powers that exist.
So I just simply pasdar to create and also like every product that every item to have a specific some
of the idea.
Right.
So also we have to get specific this product with this idea for the regions here.
We have to do we have to define all the idea.
So I just name it as a picture that means the primary key.
So now we have to do we have to check it.
We have to check it out.
This order is already exist or not.
OK, that means here we have to defining each side assembly item.
So with this item, I want to define our this object.
That means get our object data.
That means if we get any object data, then it will be get this object better than it should be.
So as a future.
So now we have to do we have to get all the other object data from our products.
That means that is in our app shop, into the app shop, into the model area.
I have already created that our product.
Right.
So now we have to also add this class.
So we in particular that position, I want to, first of all, get all that our product.
So here after this on the line to take over from in our app shop and there the models.
And from here, I want to do an import.
I want to import our product.
So to simply input that product.
So now with this product, I want to, first of all, get all the other objects.
And also we have to do we have to get it by a specific one of the idea that also they have all the specific
ideas for a specific this product.
So now I want to do to define as a picture that is our primary key will be already Kuester Primerica.
And then I want to do and define our order item.
So that is our order underscore item.
So we decided at that moment to check our cart.
That means this product is already added into our Cardella or not.
OK, that means here right now, if you want to party, these products automatically should be adding
Kataria.
And after that, if you want to add it again to first of all, it will be checking that this product
is already added in our country and not for the reasons here I want to do and to define the criteria.
So in our criteria also to the category of first of all, I define our all that our object so object.
So with this object, I don't want to get our name.
One of the function as a gate underscore or and then create.
OK, that is a great RPA.
So that is also one of the building function.
I want to use it.
So with this function, it should be actually I didn't initially get this data right then it should
be create a new one.
OK, that means we create a new one in our cart area.
OK, so here I define our gate or to create and into this area I have to define our item.
So I just simply defined that item.
Item will be our item.
And this item, actually, if you go to our cart into the cart model, I have already found the item.
Right.
So this item or I want to get so it shall be matched with this.
So I just simply defending the item will be as item.
And also here we have to define our user right now.
Which user is authenticated or not.
So here also we have to define that user.
So just take as a user and that will be already existed.
User, right.
So just requested and then user and also I want to make that thing.
So the package is false because of all.
If you go our model in the model, you can see I define our packages so far, which is positive all
this will be a default.
So when this product will be totally partisan, when our payment will.
Totally complete, then it will be the truth of the results.
By default, I want to do and to make that our party is the party of our churches will be as a false
occupant.
So here I have defining it.
And also I want to do and define our variable as in order underscore us.
That means here I want to do want to get all that our order object.
So with our order, that means I have already defined our order.
That means there is a clear order side.
So with these orders here, I want to learn to actually get all the Torah observe.
So for the reasons here, we have to defining it.
So with this order, I have already loaded our order so you can see the regular order class I have loaded.
So with this order, I want to get all that objects.
So I just simply different objects and I to do and filter it.
So with this filter, it shall be as it used, will be, as our requested user say, to simplify the
requested user.
And also I define our order.
That means if you go here into the order area C to the order area, I also make the things that false
right.
That means positive.
All will be as a false and will discuss customer actually complete this total procedure with the payment.
After that, it shall be the truth.
OK, so now that is our order.
And I also want to make the things as a false.
That means this order to this order I define as that will be as a false.
I guess I just simply make that things as a false prophet.
That means with this filter here, I define our incomplete all that order, like if you go here like.
Right.
Education, purpose, I mean, just thinking about it.
I'm just ataka this product.
Right.
That means this product is already at the cart in our Ebtekar idea.
That means that is actually our product is the programming is thinking.
So this product is already Nakata but I didn't complete that packages.
Right.
So that is in our incomplete on the order.
So for the reasons here, I define that with the filter.
That means what this user requires the user and that is our order is false.
That means that they are in complete order.
So here I don't want to define the condition.
I just simply defending the if condition, if this order.
So here I take our incomplete order into this variable.
So if this order, that Cansino incomplete order is already exist, so I just simply cannot exist.
So that is if this already exists in our criteria, then what exactly shall we do?
So here we have to defining it.
So I just simply define on another one of the order.
So with this order here, I want to define our this variable.
That means our order in complete order variable.
So here are defining it.
And here I have to do have to define the things with the zero.
OK, that means our value will be at zero.
So this object that all started from the zero.
So here I have to defining it and then I want to define our live condition again if our order.
OK, if this order in our order item, in our order items I want to do and to define the filter filter.
Absolutely.
Filter this with our item.
That means the same condition.
I have defined that the item.
OK, so I then pointed to I will be equal equal with our item when we sell with the same item.
And also if this item is already exist, say that simply they exist.
OK, so.
So it should be allowed to exist then.
What exactly will be happen.
Like it means if you go here right now, if you purchase this product, that means if you have to get
these products that this product is or will be serving our criteria.
Right.
So here I have defining this part.
That means our uncompleted order.
So here I define that our order is a false that means that our incomplete product.
Right.
So this product is already ordered in our card area.
So right now, if you go to again as a whole and if you go against this product and again, if you want
to buy this product, then what exactly it should we do?
So this product is already in our kataria.
So then I want to do I only want to update that quantity, not that product again.
OK.
So only our this quantity will be updated which product I have already added in our card area.
So here I want to define this condition.
So in our even exist and then here I want to do and define with our this order item, order underscore
item, this order item, our value will be studied as is the zero.
OK, so that is zero and this zero.
I want to update our quantity fields.
So just simply define the quantity, OK.
Or quantity will be updated.
That means the plus equal one.
OK.
I hope you can well understand about it.
So if you want to purchase these products the second time our only this product quantity field will
be updated.
Which product I have already added in our area.
So here, for the reasons here and only updated that our quantity will be as a plus one, and then I
want to do want to save this, so I just simply finish the order underscore item, this order item,
I want to save it.
So I just simply finish the safe.
OK, I think it's very much clear to you.
And when it's to be safe, I want to do want to return some of the message.
So with these messages, I have already included that we have already put our messages with these messages.
I want to show some of the message.
So I just completely forgot the tag, the info infotech and we disinfo that it will be Bosler decreased.
So with this request, I want to pass on the screen that as that this item quantity.
So this item quantity was updated.
Right.
Because of all this product is already in our area for drizzles is only it will be updated our quantity.
Right.
For the reasons here I say definer that this item quantity was updated and so I just simply better defense
is updated.
So this product item quantities updated and then also ale's what exactly should be happen like right
now if you want to add another new product.
So that is actually our new product.
So right now I want to add this product in our cart area, then what exactly is to be happen?
So then I want to go on to to take this order.
That means I want to take this product in our car area.
So here we have two defining.
It's after that else.
So I just simply defined as ls and else what exactly will happen.
Ls our order.
So we disorder our order item, ok, our order, our order items.
And now I want to do and the added.
So I want to add it in our order item area.
So that means our order underscore items into the order item area and to define that as a zero value.
OK, right.
So if this product is already existing our cart then it should be updated that quantity only and rather
then shall we add this product again.
So I just simply define our product again.
OK, and here I also want to do I want to define one of the message.
So here it should be just like that same.
OK, you should be just like that.
Same here.
I defined that message.
Message will be as an input type with this request now one to do and display some of the message as
a this item.
Is added to your card reference, I just simply defined that message and wouldn't be sure this message
and after that I want to turn to redacted to some of the pace so I will defend the return redirect,
OK, return redirect.
And with this extended attack and to policy to our home base, that means in our app shop into the app
shop I have already created on the cloud that is our home.
So here I am to pass it on here and also when it will be updated.
That means Swinish will be updated.
That portions.
I also after that, I want to understand it that Zeitun directives will be done to our app shop home
base that before a new party took to this product and successfully when you should be decorator at Canaria,
it should be directly to our home area, OK, and into the social media.
I want to do and will display this message.
So that is a message I have defined.
So the owners of ablated is to be displayed rather than to be ad Dysport, I guess to be sure that this
item is added in the card area.
Perfect.
And else that means in our total condition will be not work.
That means there is actually existing one.
So here I want to define that ale's else.
It will be added our new order.
That means here I want to define that order again.
So that is our order.
I take one of the variable and with this order, OK, with this our order class here, we have to define
all user.
User is the requested user so that the requested user.
OK, and then I want to define our autosave so our order will be as safe.
So I just simply define that are safe and wonderful border safe.
Also we have to do we have to add it, we have to added in our order item area with our own item zero
or shall we just like the same.
So here I define as the order and then our order items.
So are other items, and then I want to do and added, that means that there are fresh new order.
So I just simply added in our order, item, order, and let's go right into the order item here.
I just simply would.
Well, OK.
And after that, I and also show some of the message so that the message is I want to use that info
tag and with the infotech area and the request and the request to be able to pass on the message that
this item is added to your card.
So this will be this type of message be display.
And after that, I want to return it again, the redirect, and then it should be developing our app
shop into the app shop on base.
So to simply defend that home.
So that's all we have to do.
OK, so here we just defined find that we have this condition.
If our quantity that we saw in this product is already added in our cart, then it should be updated.
That quantity aless will be added our new product and Ayles, that is actually our if condition and
or anything else aless will be added to the same order again.
So I just simply said this order to your card area and then it shall be sure short.
So the message is that this is added in your card.
Perfect.
So now we have to do we have to create one of the rules for this one.
And after that, we have to add that action in our pace to better and to do and to continue this process.
You know, next video, I will show you that things with a live example.
So thanks for watching and I'll see you in the next video.