Join Antonio Mele de Juan for an in-depth discussion in this video Creating lists and detail views, part of Django: 2 Building a Social Website.
- [Instructor] Hi again.…This video is a continuation of the previous video.…In the previous video we created…many to many relationships with an intermediary model.…In this video we'll create list and detail views…for user profiles and build an AJAX view to follow users.…Open the views.py file of the account application,…and add these libraries.…Then we need to add these lines of code to it.…These are simple list and detail views for user objects.…
The user list view gets all active users.…The Django user model contains a flag, is active, to…designate whether the user account is considered active.…We filter the query by is active…is equal to true to return only active users.…This view returns all results,…but you can improve it by adding pagination…the same way we did for the image list view.…The user detail view uses the get object or 404 shortcut…to retrieve the active user with the given username.…
The view returns an http 404 response if no active user…with the given username is found.…Now edit the url's .py file of the account application…
Note: This course was created by Packt Publishing. We are pleased to host this training in our library.
- Building a social website
- Sharing content in your website
- Creating an image bookmarking website
- Adding Ajax actions with jQuery
- Tracking user actions
- Using Redis to store item views