
Django Authentication
User model, authentication backend, login/logout, permissions, groups, custom user model
1Which Django model is used by default to represent users in an application?
Which Django model is used by default to represent users in an application?
Jawaban
The User model from django.contrib.auth.models is the default model for managing users in Django. It provides essential fields like username, password, email, first_name, last_name, and built-in authentication methods. This model is automatically available after adding django.contrib.auth to INSTALLED_APPS.
2Which Django function verifies user credentials and returns the corresponding User object?
Which Django function verifies user credentials and returns the corresponding User object?
Jawaban
The authenticate() function from django.contrib.auth takes credentials (typically username and password) and verifies them against configured authentication backends. It returns the User object if credentials are valid, or None if authentication fails. This function does not log in the user, it only validates the credentials.
3Which function creates a session and logs in a user after successful authentication?
Which function creates a session and logs in a user after successful authentication?
Jawaban
The login() function from django.contrib.auth takes the request and the authenticated User object to create a session. It stores the user's ID in the session and associates the authentication backend used. This function must be called after authenticate() to complete the login process.
How to log out a user and invalidate their session in Django?
Which Django decorator restricts view access to logged-in users only?
+19 pertanyaan wawancara
Topik wawancara Django lainnya
Python Basics
Python OOP
Django Fundamentals
Django Models - Basics
Django Views
Django Templates
Django Forms
Advanced QuerySets
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
Kuasai Django untuk wawancara berikutnya
Akses semua pertanyaan, flashcards, tes teknis, latihan code review dan simulator wawancara.
Mulai gratis