TCS Wings 1 T4 Django - Set 10
You are building a multi-tenant Django application where each user can only access their own data. How do you restrict access in Django Rest Framework? a) Use permissions.IsAuthenticated b) Override get_queryset() method in the view c) Use AllowAny permission d) Filter by user in the serializer Answer: b) Override get_queryset() method in the view In your Django project, you want to schedule periodic tasks such as clearing expired sessions. Which library should you use to schedule these tasks? a) Django Signals b) Django Celery c) Django Cache d) Django Middleware Answer: b) Django Celery You need to retrieve the first object from a Django ORM queryset, or return None if no objects are found. Which method should you use? a) get() b) first() c) last() d) filter() Answer: b) first() In your Django Rest Framework project, you want to prevent users from making too many API requests within a short period. Which feature would you implement? a) Permission Classes b) Rate Limiting c) Aut...