Hello guys, welcome to learn vern.
In the Last topic we saw how to create forms in html.
I myself created a form to show you.
And displayed the same on the browser right? Clear?
Now today we will see form methods and ORM queries methods in django.
Okay? So let's start with form methods. right?
So form methods include two types of methods and are used to send your data to the server.
One is the get method and second is the post method.
These two transfer both the way on the server through forms okay?
First let's understand how the get method works.
So the get method takes a request to a specific resource, that is, your particular data.
It decides where, on which server or on which particular source it has to be taken.
This is the work of the get method. clear?
if you transfer through the get method, the Request of Get method stores your data in cache memory. Okay?
Request of get method also stores data in the browser history.
In short, when you use the Get method, whatever data goes into the Get method or whatever data you send, is stored in cache memory and also in browser history. okay?
When you send some sensitive data, then you should not use the get method.
Why not, because the get method shows your data in url okay?
Whatever is your particular data like suppose you sent some data using get method,
Whatever data you have sent through the get method, that will get displayed in this way.
Like if you send this, after this ‘&’ and then whatever attribute you have passed will be displayed this way okay?
Then in the same way again ‘&’ and then whatever is your particular contact, will also get displayed here.
So in this way whenever you use the Get method, your particular data is displayed here through the get method okay?
Also whatever particular data will be sent through get method, get method will store that particular data in cache memory and in browser history as well.
Plus when you use the get method, length of data is restricted i.e. limited.
You can send data only to a particular limit, after that you cannot send data through get method
Right?
Any sensitive data, important data sent through get method is displayed in url and stored in browsing history.
So it will be easy for hackers to pick your data from any of these.
That's why form has created one more method, and the method’s name is Post method.
Now the post method is also used to send, save and fetch data from the server. Okay?
also the Post method is used to create and update data on the server right?
This will never get stored in cache memory, nor in browser history.
And this does not have any limitation of data.
It's not like here that you can send data only to an extent.
You can send any unlimited sensitive data, through the post method.
Here you can send unlimited data !!
In addition you can save and update your data through the post method.
you cannot save or update your data on the server Without this method .
So you must be able to identify the differences now between both the methods.
So what does our Get method say?
That it keeps the particular data limited plus it gets stored in cache memory plus it gets stored in browser history as well okay?
The things which I am showing you today are from the theoretical part. It does not have any practical part.
That's why today you all will have theoretical knowledge only.
Okay? Right? Clear?
Now let's move to the ORM queries method.
What is actually meant by ORM queries?
Django is a ORM based framework.
I have already told you in a previous video of introduction to django about how it is a ORM base framework.
If any of you have not watched that yet, kindly watch it for clear vision.
Now ORM stands for object relational mapping okay?
So whatever SQL queries we did in python crud for example when we did my SQL connectivity with python that time we noticed the same.
There we fired insert query, delete query and update query.
So what is their benefit in this ORM?
This has created a method for every query.
First is the create method.
create method creates an object of your particular data which means insertion of data in django.
If you want to fire an insert query which means you want insertion of particular data.
So you are supposed to use the create method okay?
Then we fired the select query in SQL through which we were able to fetch all data.
Here, in django, if you wish to fetch all the data in ORM queries,
Then you have to use ALL method.
Which method? All method.
What do all method do?
In django, All your saved data will be saved as an object here, so this fetches all the objects okay?
Then our third method is the GET method.
What does the get method do? It is a method which returns a single object. Okay?
Which means when multiple objects are coming all together, that time get method will show you error of multiple return objects. Okay?
Which particular query will you fire in the GET method?
Fire Select by ID query in SQL.
then you will be able to use the get method in ORM. okay?
Let's go ahead to the filter method.
Filter method is used to fetch single object and single field in ORM.
Here also you can fire the select by id query in SQL.
Instead, use the filter method in the ORM method.
okay? If any particular data
Second is the save method, what is its use?
It is used to update your data in django.
Which means the query of update you fired in SQL, will work as a save method in ORM okay?
So through the save method you can update any particular data. Right?
And third comes the delete method.
What happens in the delete method?
You can delete any particular object.
The query of delete you fired in SQL has become the same delete method in ORM.
So through which you can delete any particular object in django.
So these were some query methods and form methods which i told you today.
this was also a theoretical video okay?
because This was a theoretical topic.
That is why I told you theoretically and not practically.
I will tell you practically all this in next video when we will create crud application
In django with my SQL connectivity.
I will repeat all these things in that.
So let's meet in the next video where I will tell you about the crud application with my MySQL connectivity. Okay guys?
If you have any queries or comments, click the discussion button below the video and post there. This way, you will be able to connect to fellow learners and discuss the course. Also, Our Team will try to solve your query
Thankyou
Share a personalized message with your friends.