CMU 15-190 Spring 2017: Topics in Intermediate Programming
Homework 8 (Due Wednesday 5-Apr, at 11:59pm)
- This hw is optional. It is for students who want to get a bit more out of the optional/advanced talk last week, and in particular for those who may wish to get 3 units of pass/fail credit for 15-190 (for whom it is required). We hope that's quite a few of you!
- Work Solo or in Groups of 2-5 (and groups are strongly recommended) Have fun!
- We will grade the hw, but loosely, and chiefly based on effort. You should expect to invest 1-2 hours on it and you'll be fine. This is not about the grade, of course, but about the learning. So take your time, discuss issues with your groupmates, have fun, and enjoy.
- Please track when you start and stop working on this, and with whom you collaborate. You'll need that for your submission. And again, have fun.
All the information, code, and examples we talked about in the past two lectures can be found in the GitBook here.
Here is the code for Instagram that we wrote during lecture. Note that it is just the django code, you should make a virtual environment as discussed and then put the Django code inside of it to get it up and running.
One piece of functionality has been added in for you which will be important for the homework. We added an individual post page, making it so that if you click on a post, it opens a new URL and page with info on just the post. The step by step break down (disclaimer: not polished yet) is found here in the GitBook. It is crucial you read though that section and understand how it works.
The assignment is as follows:
-
Short Answer
- Briefly explain the reason why we need back-end web-frameworks like Django.
- Explain the basic purpose of the urls.py file.
- Briefly describe, to the best of your abilities, what a foreign key relationship in a database is.
- Where are all servers located?
-
Programming
In the lectures, we rebuilt Instagram (kind of...). Now, your job is to add a new feature to this website: A Profile Page. The details related to the design of the page are left up to you, but the Profile Page must have the name of the user and all of the posts they've made (with images). The steps for doing this are as follows (with links to book sections on each topic):- Create the URL pattern that roughly looks like "/profile/(name)"
- Create the view to handle this
- In the view, filter the Posts table to find only posts where it was postedBy the user in question
- Send this data to the front end through the context of the view
- Dynamically generate the HTML for each post
-
What to Submit
Each member of the group should submit a zip file with two things:
(1) A PDF file, name 15-190-hw8.pdf, containing this information:- Your name and andrew id
- The names and andrew id's of your groupmates
- The start/stop times you worked, and the total time you worked.
- Your thoughts about this exercise -- useful, interesting, etc? This will help us improve the 15-190 experience as we go.
- The solutions from above. Note: one way to create a PDF is to first make a Word file, then export that to PDF.
(2) The zip file of your django project with the profile page implemented. To make a zip file, you simply right click on a folder and click "compress". To make the final submission, place the PDF and django code in a folder and then compress the folder.
Have fun!