Useful Links
Computer Science
Web Development
Django Framework
1. Introduction to Django
2. Getting Started
3. Models: The Data Layer
4. Views: The Logic Layer
5. Templates: The Presentation Layer
6. URL Routing
7. Forms
8. The Django Admin
9. Static and Media Files
10. Authentication and Authorization
11. Testing
12. Security
13. Advanced Topics
14. Deployment
15. Extending Django
Views: The Logic Layer
The Request/Response Cycle
HTTP Request Flow
URL Resolution
View Execution
Returning HTTP Responses
Middleware Processing
Function-Based Views (FBVs)
Structure of a Function-Based View
The `request` Object
Attributes and Methods
Accessing GET and POST Data
Accessing Files and Cookies
Request Headers
Request Method
Request Path and URL
Returning `HttpResponse`
Content Types
Status Codes
Custom Headers
Returning `JsonResponse`
Serializing Data
Setting Safe Mode
Custom JSON Encoders
Rendering Templates with `render()`
Passing Context Data
Template Selection
Request Context Processors
Redirects
Using `redirect()`
Permanent vs. Temporary Redirects
Redirecting to Named URLs
Error Handling
Raising `Http404`
Using `get_object_or_404()`
Using `get_list_or_404()`
Class-Based Views (CBVs)
Introduction to CBVs
Advantages and Use Cases
Inheritance and Mixins
Method Resolution Order
Generic Display Views
`View`
`TemplateView`
`ListView`
Pagination
Filtering
Ordering
`DetailView`
URL Parameters
Context Object Name
Generic Editing Views
`FormView`
`CreateView`
`UpdateView`
`DeleteView`
Overriding Methods in CBVs
`get()`
`post()`
`get_context_data()`
`get_queryset()`
`get_object()`
`form_valid()`
`form_invalid()`
Mixins
`LoginRequiredMixin`
`PermissionRequiredMixin`
`UserPassesTestMixin`
Custom Mixins
View Decorators
Restricting Access
`@login_required`
`@permission_required`
`@user_passes_test`
Controlling HTTP Methods
`@require_http_methods`
`@require_GET`
`@require_POST`
`@require_safe`
Caching Views
`@cache_page`
`@never_cache`
`@vary_on_headers`
`@vary_on_cookie`
CSRF Protection
`@csrf_exempt`
`@csrf_protect`
Conditional Processing
`@condition`
`@etag`
`@last_modified`
Previous
3. Models: The Data Layer
Go to top
Next
5. Templates: The Presentation Layer