How the database with Django works? ==================================== Django provided "Database Abstraction API" ==> we can perform any operations on the table. ==> Create object Update object Delete object ==> To perform the database table operations, we need to use "python shell" ==> we need to start the python shell using: $ python manage.py shell ==> open the python interactive shell ==> we should import the class which we created as model for database Syntax: from appName.models import Model(Class_name) ==> Before going enter objects into table: we should check whether any objects have created or not. Syntax: Model-Name.objects.all() ==> We need to add objects into the database table: Syntax: object-name = Model-Name(att1 = val1, att2 = val2, ...) ==> After the creation object into the table class, we need to save that object. Syntax: object-name.save() ==> To get the row number or the identity of row in a table, we have two properties: id pk ==> primary Key Syntax: for id object-name.id for pk object-name.pk ==> To exit from the python shell: Syntax: exit() =================================================================== Database Operations from Admin: =============================== 1) we need to create the admin user for our project. $ python manage.py createsuperuser 2) Enter User name 3) Enter Password 4) Re-Enter Password 5) We should run the server: $ python manage.py runserver 6) open server URL in Browser and modify the url http://127.0.0.1:8000===> http://127.0.0.1:8000/admin 7) In Admin login page: enter your credentials and click on login