Difference between revisions of "Module 5"
m (→Grading) |
m (→Grading) |
||
Line 110: | Line 110: | ||
#*** Polls can have specified start times and end times | #*** Polls can have specified start times and end times | ||
#*** The poll entirely shuts down when it is "off" (i.e., the template should not load and the view should not allow more votes to be cast) | #*** The poll entirely shuts down when it is "off" (i.e., the template should not load and the view should not allow more votes to be cast) | ||
− | #** '''Unit Testing and | + | #** '''Unit Testing and Appearance''' |
#*** These are the last two steps of the Django 1.5 tutorial. | #*** These are the last two steps of the Django 1.5 tutorial. | ||
#* '''''Best Practices (5 Points):''''' | #* '''''Best Practices (5 Points):''''' |
Revision as of 06:16, 21 October 2013
In Module 5, you will learn about Git, a version control system, and Django, a web framework.
This article contains your assignments for Module 5.
Reading
The following articles on the online class wiki textbook contain information that will help you complete the assignments.
Individual Assignments
Django Tutorial
The web framework we will be using in Module 5 is called Django. Django is the dominant Python-based web framework and is useful for large web sites.
Before you may begin, you need to install Django. You may do this using pip, which you installed in Module 4. Django's package name in pip is Django.
Once you have Django installed, complete the official Django tutorial. You will be creating a simple poll app. There are four parts to the tutorial.
It is important that you do all the steps in the tutorial in order to get comfortable defining models, views, templates, and using the interactive shell and the admin app. Understanding these concepts will make the project go much quicker.
Tip: It is recommended that you install a copy of Python and Django on your local computer. This way, you will not need to upload the files to your server every time you make a change, because your server will be running locally.
Tip: When testing Django on your EC2 instance, make sure to open port 8000 for your instance on AWS (and to click "apply rule changes").
- Part 1
- Create a project
- Start the development server
- Setup an SQLite database
- Create the Polls app and define the models
- Interact with the database using the interactive python shell
- Part 2
- Activate the admin site
- Add the poll app to the admin site
- Modify the database using the admin site
- Part 3
- Configure URL handling
- Create some views
- Part 4
- Write a form that modifies the database
- Refactor to use generic views
Group Project
Extending the Polls App using Version Control
As your group project, you and your partner will each independently add an additional feature to the polls app you made in the individual portion. You will each be working in your own branch in your group Git repository. When the features are complete, you will merge them back into the master branch.
- Someone in your group needs to copy their tutorial code from the individual portion into the master branch of the group repository.
- After pushing and pulling, everyone should have the up-to-date master branch on their machine.
- Each person in the group should then make a new branch named with their first name.
- Each person can then individually work on their new feature. Here are some ideas for new features that will all earn full credit.
- If there is a feature not on this list that you would like to add, save it for the Creative Portion.
- Important: Refer to the grading section for more details on our expectations for the features.
- Enable users to create and edit their own polls
- Add user accounts. Polls voted on would be associated with the account. Note that Django comes built-in with user accounts; you just need to wire a few things up. Refer to the Django documentation for details.
- Check for double votes using an IP address or a cookie
- Food for Thought: What are the pros and cons of using IP addresses to block double votes compared to cookies?
- Set a timeout for polls (e.g., ensure that the poll is active for only 7 days)
- Complete the last two steps of the Django tutorial (unit testing and appearance).
- When someone completes their feature, they should merge their branch into the master branch, and everyone else in the group should merge the master branch (which now has the new feature) into their personal working branch.
Creative Portion
As your creative portion, you may either add your own feature, or you may add another of the suggested features above. See the grading section for details.
Web Security and Validation
Web frameworks take care of a lot of the security practices you learned in modules 2 and 3. For more information on Django security, refer to the Django documentation: https://docs.djangoproject.com/en/dev/topics/security/
You still need to ensure that all pages on your site pass the W3C validation.
Grading
We will be grading the following aspects of your work. There are 70 points total.
- Django Tutorial (15 points):
- Database schema and models set up (4 points)
- Admin page working (4 points)
- URL routing is correct (3 points)
- Correct implementation of MVC (or, shall we say, MTV) architecture (4 points)
- Extend Polls Application (45 Points):
- Version Control (15 Points):
- Each team member has their own branch in Git (5 points)
- The branching view in SourceTree indicates that features were merged into master as they were completed and from there merged into each member's working branch (10 points)
- Features (20 Points):
- The rubric for four features are shown below; each one is worth 10 points. You need only two of the four to satisfy this requirement. Implementation of a third additional feature will count for the Creative Portion; see below for details.
- Poll Creation and Editing
- Users can specify any number of choices for the poll
- If the "Timeout" feature is implemented, a timeout can be specified for the poll
- Note: When a poll is edited, you can choose whether to always reset all votes, or whether to keep old votes between edits of the poll.
- User Accounts
- Users can log in and log out
- Votes on polls are associated with a user
- Preventing Double Votes
- If using the IP-based approach, you store the IP address using the correct SQL data type (i.e., not a string)
- If using the cookie-based approach, your cookie format is not something that the end user can easily figure out and manipulate
- Note: You will not earn credit for implementing both an IP-based and a Cookie-based approach.
- Poll Timeout
- Polls can have specified start times and end times
- The poll entirely shuts down when it is "off" (i.e., the template should not load and the view should not allow more votes to be cast)
- Unit Testing and Appearance
- These are the last two steps of the Django 1.5 tutorial.
- Best Practices (5 Points):
- Code is well organized and conforms to Django conventions (3 points)
- All pages pass the W3C validator (2 points)
- Usability (5 Points):
- Site is intuitive to use and navigate (4 points)
- Site is visually appealing (1 point)
- Version Control (15 Points):
- Creative Portion (10 Points):
- Each one of the eight features listed in the "Features" section is worth 10 points.
- A novel feature not listed in the "Features" section may be worth a full 10 points.
For Clarification Only:
- Zero Suggested Features = 20 Points Lost in Group Portion
- One Suggested Feature = 10 Points Lost in Group Portion
- Two Suggested Features = No Points Lost in Group Portion
- Three Suggested Features = No Points Lost in Group Portion and 10 Points in Creative Portion
- Two Suggested Features + a TA-Approved Novel Feature = No Points Lost in Group Portion and 10 Points in Creative Portion
- Note: No extra credit will be granted for completion of additional suggested features if your creative portion is already satisfied.