1. What is a Django View?

 

A view is a Python function or class that receives a request and returns a response.

2. What is URL routing in Django?

It maps URLs to corresponding views.

3. What is urls.py?

A file that defines URL patterns for the application.

4. What is path()?

A function used to define URL patterns.

5. What is re_path()?

Used for regex-based URL matching.

6. What is a request object?

An object containing data sent by the client.

7. What is a response object?

An object returned to the client.

8. What is HttpResponse?

A class used to send response data.

9. What is render()?

Renders HTML template with context data.

10. What is redirect()?

Redirects user to another URL.


11. What are Function-Based Views (FBV)?

Views written as Python functions.

12. What are Class-Based Views (CBV)?

Views written as Python classes.

13. Difference between FBV and CBV?

FBV are simple; CBV provide reusable structure.

14. What is request.method?

Returns HTTP method like GET or POST.

15. What is GET request?

Used to retrieve data.

16. What is POST request?

Used to send data.

17. What is request.GET?

Dictionary-like object for GET data.

18. What is request.POST?

Contains POST data.

19. What is request.FILES?

Handles file uploads.

20. What is request.user?

Returns logged-in user.


21. What is URL pattern?

A mapping between URL and view.

22. What is name parameter in URL?

Used to reference URLs uniquely.

23. What is include()?

Includes app-level URLs.

24. Why use include()?

For modular URL structure.

25. What is dynamic URL?

URL with variable parts.

26. Example of dynamic URL?

path('post/<int:id>/', views.post)

27. What is URL parameter?

Value passed through URL.

28. What is reverse()?

Generates URL from name.

29. What is reverse_lazy()?

Lazy version of reverse.

30. What is namespace in URLs?

Helps avoid naming conflicts.


31. What is TemplateView?

CBV for rendering templates.

32. What is ListView?

Displays list of objects.

33. What is DetailView?

Displays single object.

34. What is CreateView?

Creates new object.

35. What is UpdateView?

Updates object.

36. What is DeleteView?

Deletes object.

37. What is context in view?

Data passed to template.

38. What is dispatch()?

Handles HTTP methods in CBV.

39. What is as_view()?

Converts class into callable view.

40. What is mixin?

Reusable class for CBV.


41. What is login_required?

Decorator to restrict access.

42. What is permission_required?

Checks user permissions.

43. What is csrf_token?

Prevents CSRF attacks.

44. What is Http404?

Raises 404 error.

45. What is get_object_or_404?

Returns object or 404 error.

46. What is get_list_or_404?

Returns list or 404.

47. What is JsonResponse?

Returns JSON data.

48. What is StreamingHttpResponse?

Streams large responses.

49. What is FileResponse?

Returns files.

50. What is middleware in request?

Processes request before view.


51. What is URL reversing?

Generating URLs dynamically.

52. What is APPEND_SLASH?

Adds slash automatically.

53. What is ROOT_URLCONF?

Main URL config file.

54. What is DEBUG in URLs?

Shows debug errors.

55. What is static() helper?

Serves static files in development.

56. What is media URL handling?

Serves uploaded files.

57. What is URL dispatcher flow?

Request → URL → View → Response.

58. What is view decorator?

Modifies view behavior.

59. What is cache_page?

Caches view output.

60. What is never_cache?

Disables caching.


61. What is AJAX in Django views?

Handles asynchronous requests.

62. What is API view?

Returns data instead of HTML.

63. What is DRF view?

View from Django REST Framework.

64. What is function decorator?

Wraps view function.

65. What is method decorator?

Applies to CBV methods.

66. What is slug in URL?

Readable identifier.

67. What is kwargs?

Keyword arguments in URLs.

68. What is args?

Positional arguments.

69. What is request.path?

Returns URL path.

70. What is request.session?

Stores session data.


71. What is request.headers?

Contains HTTP headers.

72. What is request.body?

Raw request data.

73. What is request.META?

Server metadata.

74. What is HttpResponseRedirect?

Redirect response.

75. What is status code?

Indicates response status.

76. What is 200 status?

Success.

77. What is 404 status?

Not found.

78. What is 500 status?

Server error.

79. What is URLconf?

URL configuration.

80. What is resolver_match?

Matched URL info.


81. What is view inheritance?

Extending views.

82. What is generic views?

Pre-built views.

83. What is base view?

Parent view class.

84. What is template_name?

Specifies template.

85. What is context_object_name?

Name of context variable.

86. What is success_url?

Redirect URL after success.

87. What is form_valid()?

Handles valid form.

88. What is form_invalid()?

Handles invalid form.

89. What is get_queryset()?

Returns queryset.

90. What is get_context_data()?

Adds extra context.


91. What is pagination?

Splitting data into pages.

92. What is paginate_by?

Defines items per page.

93. What is URL naming best practice?

Use meaningful names.

94. What is SEO-friendly URL?

Readable and keyword-based URL.

95. What is trailing slash?

Slash at end of URL.

96. What is URL performance optimization?

Efficient routing and caching.

97. What is view optimization?

Reducing database queries.

98. What is lazy URL loading?

Load URL when needed.

99. What is Django URL best practice?

Keep URLs clean and modular.

100. How to design scalable views?

Use CBV, caching, and optimized queries.

.

📢 Join Our WhatsApp Channel

💼 Get Daily IT Job Updates, Interview Preparation Tips & Instant Alerts directly on WhatsApp.

👉 Join WhatsApp Now

📢 Join Our Telegram Channel

💼 Get Daily IT Job Updates, Interview Tips & Exclusive Alerts directly on Telegram!

👉 Join Telegram

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © 2022 - 2025 itfreesource.com

Enable Notifications OK No thanks