//ONE LINE SYNTAX TO SAVE DATA
person = Person.objects.create(first_name="John", last_name="Deo")
//YOU CAN ALSO USE BELOW CODE TO SAVE DATA
person = Person(first_name="John", last_name="Deo")
person.save()
Creating or saving object data in Django is very simple and it can be achieved using the provided code snippet. In the code snippet, we are using a 'Person' model which has fields named 'first_name' and 'last_name'. The above code will insert data into the table where 'John' will be inserted in the 'first_name' column and 'Deo' will be inserted into the 'last_name' column.
0 Comments