Project 8 - Secure Superhero Data Views
Goals
- Extend Data Views with User Security
- Build an applications that has for generic Django views for the CRUD operations
- Django View Classes
- TemplateView
- ListView
- DetailView
- CreateView
- UpdateView
- DeleteView
- Customize each of the views
- Use View Inheritance to apply styles and structure
- User Management
- Users can Register
- Users login/logout
- Edit operations require login
Steps
Create a new Django project
- The default view should contain a list of link to superheroes
- An add button will let users add a new record
ListView
- Create a table or divs that show a list of records
- Each hero should have a link that goes to the details page
DetailView
- Display all info from the Database records
- Show the image as a thumbnail with a link to the large image
- Add a button to Edit the record
CreateView
- Create new records with a view
- You can cheat by loading the image file into a directory
- Add the image as a URL pointing to this file
- Requires login
UpdateView
- Make sure that you can edit the records
- Make sure that the page is redirected after save
- Requires login
DeleteView
- Delete the records after confirmation
- Go to the list after a delete
- Requires login
View Inheritance
- Create a base page template
- Style all pages without duplicating any code
Add five Superhero records
Create Superhero Pages
- Build one set of templates
- Build view that take arguments and displays the contents
- Build a URL route that call your view
Create Images
- Create images that match your five selected heroes
- Add an image to your view to display the superhero image
- Debug your application code until photos display
- Commit to your Github repo
- Deploy at Python Anywhere
Create Superhero Theme
- Create a HTML template "superhero_theme.html"
- Add a bootstrap CSS and custom CSS to this template
- Add a "{% block content %}" section to the template
- Make index.html and hero.html use "{% extends 'superhero_theme.html' %}"
- Debug the view inheritance
- Give you pages some cool style
Test the pages
- Browse to http://YOUR_USER.pythonanywhere.com for Your Site
- Make sure this address is set in Sensei
Requirements
- Your page must be available at http://YOUR_USER.pythonanywhere.com
- It must contain info about superheroes
- All heroes must come from database records
- ListView, DetailView
- CreateView requires login
- UpdateView requires login
- DeleteView requires login
- Register
- View Inheritance - "superhero_theme.html" base template for all pages
- Nice page style and layout