
Django Models - Basics
Model fields, field types, Meta class, model methods, QuerySet basics, migrations
1What is a Model in Django?
What is a Model in Django?
คำตอบ
A Django Model is a Python class that represents a table in the database. Each Model attribute corresponds to a column in the table. Django uses ORM (Object-Relational Mapping) to automatically translate operations on Python objects into SQL queries, allowing database manipulation without writing SQL directly.
2Which base class should be used to create a Django Model?
Which base class should be used to create a Django Model?
คำตอบ
All Django Models must inherit from django.db.models.Model. This base class provides all the necessary functionality to interact with the database: table creation, queries, saving, deletion, etc. Without this inheritance, the class would not be recognized as a Model by Django.
3Which field type should be used to store a string with a limited length?
Which field type should be used to store a string with a limited length?
คำตอบ
CharField is used to store short to medium strings with a maximum length defined via max_length. This parameter is required for CharField. For longer texts without size limits, TextField should be used instead as it has no length restriction.
What is the difference between the null and blank options in a Django field?
How to define a default value for a Model field?
+19 คำถามสัมภาษณ์
หัวข้อสัมภาษณ์ Django อื่นๆ
Python Basics
Python OOP
Django Fundamentals
Django Views
Django Templates
Django Forms
Advanced QuerySets
Django Authentication
Django Middleware
Django Admin
Django REST Framework
Django Signals
File Upload
Django Caching
Django Sessions
Django Email
Django Testing
Django Security
Django Deployment
Advanced Django ORM
Django Performance
Django & Celery
Django Channels
Django & GraphQL
Django & Docker
Django in Microservices Ecosystem
Custom Django Commands
Django Internationalization
Django Design Patterns
Django Async & ASGI
Settings & Production Configuration
Observability & Monitoring
เชี่ยวชาญ Django สำหรับการสัมภาษณ์ครั้งถัดไป
เข้าถึงคำถามทั้งหมด flashcards แบบทดสอบเทคนิค แบบฝึกหัด code review และตัวจำลองสัมภาษณ์
เริ่มใช้ฟรี