Django Framework

  1. Views: The Logic Layer
    1. The Request/Response Cycle
      1. HTTP Request Flow
        1. URL Resolution
          1. View Execution
            1. Returning HTTP Responses
              1. Middleware Processing
              2. Function-Based Views (FBVs)
                1. Structure of a Function-Based View
                  1. The `request` Object
                    1. Attributes and Methods
                      1. Accessing GET and POST Data
                        1. Accessing Files and Cookies
                          1. Request Headers
                            1. Request Method
                              1. Request Path and URL
                              2. Returning `HttpResponse`
                                1. Content Types
                                  1. Status Codes
                                    1. Custom Headers
                                    2. Returning `JsonResponse`
                                      1. Serializing Data
                                        1. Setting Safe Mode
                                          1. Custom JSON Encoders
                                          2. Rendering Templates with `render()`
                                            1. Passing Context Data
                                              1. Template Selection
                                                1. Request Context Processors
                                                2. Redirects
                                                  1. Using `redirect()`
                                                    1. Permanent vs. Temporary Redirects
                                                      1. Redirecting to Named URLs
                                                      2. Error Handling
                                                        1. Raising `Http404`
                                                          1. Using `get_object_or_404()`
                                                            1. Using `get_list_or_404()`
                                                          2. Class-Based Views (CBVs)
                                                            1. Introduction to CBVs
                                                              1. Advantages and Use Cases
                                                                1. Inheritance and Mixins
                                                                  1. Method Resolution Order
                                                                  2. Generic Display Views
                                                                    1. `View`
                                                                      1. `TemplateView`
                                                                        1. `ListView`
                                                                          1. Pagination
                                                                            1. Filtering
                                                                              1. Ordering
                                                                              2. `DetailView`
                                                                                1. URL Parameters
                                                                                  1. Context Object Name
                                                                                2. Generic Editing Views
                                                                                  1. `FormView`
                                                                                    1. `CreateView`
                                                                                      1. `UpdateView`
                                                                                        1. `DeleteView`
                                                                                        2. Overriding Methods in CBVs
                                                                                          1. `get()`
                                                                                            1. `post()`
                                                                                              1. `get_context_data()`
                                                                                                1. `get_queryset()`
                                                                                                  1. `get_object()`
                                                                                                    1. `form_valid()`
                                                                                                      1. `form_invalid()`
                                                                                                      2. Mixins
                                                                                                        1. `LoginRequiredMixin`
                                                                                                          1. `PermissionRequiredMixin`
                                                                                                            1. `UserPassesTestMixin`
                                                                                                              1. Custom Mixins
                                                                                                            2. View Decorators
                                                                                                              1. Restricting Access
                                                                                                                1. `@login_required`
                                                                                                                  1. `@permission_required`
                                                                                                                    1. `@user_passes_test`
                                                                                                                    2. Controlling HTTP Methods
                                                                                                                      1. `@require_http_methods`
                                                                                                                        1. `@require_GET`
                                                                                                                          1. `@require_POST`
                                                                                                                            1. `@require_safe`
                                                                                                                            2. Caching Views
                                                                                                                              1. `@cache_page`
                                                                                                                                1. `@never_cache`
                                                                                                                                  1. `@vary_on_headers`
                                                                                                                                  2. CSRF Protection
                                                                                                                                    1. `@csrf_exempt`
                                                                                                                                      1. `@csrf_protect`
                                                                                                                                      2. Conditional Processing
                                                                                                                                        1. `@condition`
                                                                                                                                          1. `@etag`
                                                                                                                                            1. `@last_modified`