Django Views

CIS1902 Python Programming

Reminders

  • HW3 has been extended and is now due on Thursday.
  • Final project proposals are due Friday.
  • HW4 will be released later this week and will be due on April 29th, the last day of class.
    • You'll be implementing a small version of Reddit!

Django Votr Lab: Review

Let's take a step back and look at where we currently are:

  • We created a Django application and setup the skeleton for views.
  • We then defined the models Question and Choice to represent our polls.
  • We registered these models to the Django admin site which let us easily create test data.
  • We built a simple homepage that displayed a list of the most recent questions using a Django template.

Django Votr Lab

We'll finish up our Votr app with the following steps:

  1. User Login/Signup
  2. Model to store votes
  3. View and logic for voting
  4. Django's Generic Views
  5. Polishing Views (Bootstrap)

Outline of Implementation Plan

  • We need to keep track of votes still, but we would like it so that each user can only vote once. We can encode this logic at the model level with database constraints.
  • Once we define a model, we need to create a view (HTML) and route (backend logic) that allows users to submit votes.
  • Finally, once all of our functionality is done, we can spend some time to polish the application to make it look nice.