- What is Python?
- How to Install Python?
- Python Variables and Operators
- Python Loops
- Python Functions
- Python Files
- Python Errors and Exceptions
- Python Packages
- Python Classes and Objects
- Python Strings
- PostgreSQL Data Types
- Python Generators and Decorators
- Python Dictionary
- Python Date and Time
- Python List and Tuples
- Python Multithreading and Synchronization
- Python Modules
- What is Python bytecode?
- Python Regular Expressions
Python Panda Tutorial
- Python Pandas Tutorial
- Python Pandas Features
- Advantages and Disadvantages of Python Pandas
- Pandas Library In Python
- Pandas Series To Frame
- Python Dataframeaggregate and Assign
- Pandas Dataframe Describe
- Pandas Dataframe Mean
- Pandas Hist
- Pandas Dataframe Sum
- How to convert Pandas DataFrame to Numpy array
- Pandas Concatenation
- Pandas Shift
- Pandas Rolling
- Data Analysis With Pandas and Python
- How Python Panda Are Helpful For With Data Science
- Selenium Basics
- Selenium with Python Introduction and Installation
- Navigating links using get method Selenium Python
- Locating Single Elements in Selenium Python
- Locating Multiple elements in Selenium Python
Python Flask Tutorial
- How to Install Django and Set Up a Virtual Environment in 6 Steps
- Django MTV Architecture
- Django Models
- Django Views
- Django Templates
- Django Template Language
- Django Project Layout
- Django Admin Interface
- Django Database
- Django URLs and URLConf
- Django Redirects
- Django Cookies and Cookies Handling
- Django Caching
- Types of Caching in Django
- Django Sessions
- Django Forms Handling & Validation
- Django Exceptions & Error-handling
- Django Forms Validation
- Django Redirects
- Django Admin Interface
- Django Bootstrap
- Ajax in Django
- Django Migrations and Database Connectivity
- Django Web Hosting and IDE
- Django Admin Customization
- What is CRUD?
- Django ORM
- Django Request-Response Cycle
- Django ORM
- Making a basic_api with DRF
- Django Logging
- Django Applications
- Difference between Flask vs Django
- Difference between Django vs PHP
- Numpy Introduction
- NumPy– Environment Setup
- NumPy - Data Types
- NumPy Histogram
- Matrix in NumPy
- NumPy Arrays
- NumPy Array Functions
- Matrix Multiplication in NumPy
- NumPy Matrix Transpose
- NumPy Array Append
- NumPy empty array
- NumPy Linear Algebra
- NumPy sum
- NumPy Normal Distribution
- NumPy correlation
- Why we learn and use Numpy?
- Introduction To Tensorflow
- INTRODUCTION TO DEEP LEARNING
- EXPLAIN NEURAL NETWORK?
- CONVOLUTIONAL AND RECURRENT NEURAL NETWORK
- INTRODUCTION TO TENSORFLOW
- INSTALLATION OF TENSORFLOW
- TENSORBOARD VISUALIZATION
- Linear regression in tensorflow
- Word Embedding
- Difference between CNN And RNN
- Explain Keras
- Program elements in tensorflow
- Recurrent Neural Network
- Tensorflow Object Detection
- EXPLAIN MULTILAYER PERCEPTRON
- GRADIENT DESCENT OPTIMIZATION
Interview Questions & Answers
Django Admin Interface
What is Admin Interface?
The Admin interface of a website is the control panel of your website/ project. It is used by the administrators of the website to add, delete and edit the content on the site, and also maintain other functionalities accordingly made by the developers.
But there is a catch, admin interface being the main controller, it is needed to be coded by the developer individually. You have to take care of everything, from connection to the database to securing the admin interface as anyone using it is actually the controller and any security loophole in this is disastrous for your website.
Working on Django Admin Interface
What is Django Admin?
Django Admin is the preloaded interface made to fulfill all the needs of the developers. Its language is quite generalized rather than technical.
The Django Admin is a fully featured interface and you won’t need to write an Admin interface for your project now. To begin with, it is always better to know the process of setting up Django Admin site as you will need it in future projects.
Setting Up Django Admin Site
Below are the steps to use the Django Admin Site and implement user models:
After starting the Django server, if we search in the URL bar:
Open the PowerShell or terminal and break the server by Ctrl + C.
Then type in this command:
python manage.py createsuperuser
After executing this command, it will ask for your username, which is your choice again. Then it will ask you for the Email Id and Password. Complete the details.
There are some inbuilt security features here like if your password is totally numeric it will display a message to create a complex password and many such security loopholes have been covered up for users.
What is a Superuser?
It is basically the credentials of the admin for your website, which can do any data manipulation and content manipulation related to your website.
Also, note that you should never share the superuser credentials with anyone, as it is the main controller of your website. When the website goes live, it is vital information for maintaining and controlling your website.
After successfully creating the superuser we are now going to log in to that admin page to start your Django server again.
Logging in to Admin Site
Now login in admin using the credentials you just created.
Since we haven’t registered our custom applications with the Django admin interface yet, therefore it is not showing any of them. There are only two fields here and you have two options with each of them.
Now click on the users field.
Now, you can check whether the user you created got saved in it. Although you didn’t do anything with the database.
Open phpMyAdmin and open the Django project’s database which we created, there open the auth_users table. You will get your credentials as it is, except Password.
Implementing User Models
Now we will be integrating the model student created in Django Models tutorial with the Django Admin interface for better functionality.
Go to home in the Django Project.
Now open the file admin.py of your app. The directory structure should be like this.
Open the admin.py file and type in these two lines
from .models import Student
The first statement is to import class Student or the custom model we created.
The second line is to pass the model or register the model to the Django Admin interface.
Now, open the localhost/admin again, and it wouldn’t ask you for a password.
We got the students model in admin and then, open that student field.
You will get the list of students we have and you can see a useful option there, like add a new student.
Adding a new student will actually add a new record in your database, all of it is the work of the Django Admin interface that integrates with Django ORM.
Now, click on any student-object.
Here you can directly access and edit the information, without even going into the database.
For all of that, we have just written two lines of code. Here also you can see different options like save and delete.
See the power it gives you without writing the Django Admin interface itself. We mean it’s easy to use plus it’s much more secure than anything we have written for the same.
Apply now for Advanced Python Training Course