avatarTomas Svojanovsky

Summarize

Django Interview Questions (Part 2)

While we’ve previously delved into discussions about creating projects and architecture, let’s now shift our focus to potential interview questions that could catch us off guard, particularly when dealing with large frameworks like Django.

Small frameworks may not offer as much room for surprise, but given the extensive nature of Django, there’s ample space for unexpected challenges.

Did you miss the previous part? Don’t worry!

It’s not necessary to follow it step by step. Whether you need to revise or understand the previous topic, Part 1 will be there for you.

What is a view? Do we need to register it?

In Django, a view is responsible for determining what a user sees. It retrieves data from relevant models, performs any necessary calculations, and passes the processed information to a template. Views play a crucial role in controlling the application’s user interface.

As for registration, views need to be connected to specific URLs to be accessible. In the urls.py file, you configure the routing for your Django application, establishing the connection between URLs and corresponding views.

What is CRUD?

It's not specific to Django, but they are common functionalities in our apps. CRUD stands for Create, Read, Update, and Delete. It represents the basic operations that can be performed on data in a database. These operations are fundamental to web development as they enable interaction with and manipulation of data.

Create (C):

  • Definition: Involves adding new records or entities to the database.
  • Example: When a user submits a registration form on a website, a new user account is created in the database.

Read (R):

  • Definition: Involves retrieving or querying data from the database.
  • Example: Displaying a list of products on an e-commerce site by fetching data from the product database table.

Update (U):

  • Definition: Involves modifying existing records or entities in the database.
  • Example: Allowing users to edit their profile information, and updating the corresponding record in the user database.

Delete (D):

  • Definition: Involves removing records or entities from the database.
  • Example: Allowing users to delete their posts on a social media platform, removing the associated data from the database.

What is Django ORM?

Django ORM is a database abstraction API with which we can interact with its database models, performing actions such as adding, deleting, modifying, and querying objects. We can define a class that represents a table, and with migrations, we can propagate it to the database. I appreciate how we can build queries; we can easily retrieve data via foreign keys without the need to write complex queries. Django ORM will handle it for us.

What is Django Admin?

Django Admin is a fully customizable, built-in admin interface that comes bundled with Django, allowing us to check our tables and data in the UI. This "app" enables developers to view and manipulate all data stored in the database, including registered apps and models. To make a database table accessible through the admin interface, the corresponding model must be registered in the admin.py file.

Thanks for reading my article!

If you enjoyed the read and want to be part of our growing community, hit the follow button, and let’s embark on a knowledge journey together.

Your feedback and comments are always welcome, so don’t hold back!

PlainEnglish.io 🚀

Thank you for being a part of the In Plain English community! Before you go:

Software Development
Django
Python
Recommended from ReadMedium