In Django, you can start an interactive shell to directly interact with the database and perform operations on the models. This can be done by typing the following command :
python manage.py shell
This has open an interactive console for us to execute our python code.
First thing you need to do here is to import your django model which you want to use.
from modeldemo.models import Person
Replace modeldemo
with your respective app name.
You can create an object for the model using the create
function.
Person.objects.create(first_name='Ed', last_name='Kool', birth_date='1995-01-01')
And there you go, you have created an object for the Person model. Similarly, you can create more objects for the model.