CMU 15-190 Spring 2017: Topics in Intermediate Programming
Homework 8 (Due Wednesday 5-Apr, at 11:59pm)



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:

  1. Short Answer
    1. Briefly explain the reason why we need back-end web-frameworks like Django.
    2. Explain the basic purpose of the urls.py file.
    3. Briefly describe, to the best of your abilities, what a foreign key relationship in a database is.
    4. Where are all servers located?
  2. 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):
    1. Create the URL pattern that roughly looks like "/profile/(name)"
    2. Create the view to handle this
    3. In the view, filter the Posts table to find only posts where it was postedBy the user in question
    4. Send this data to the front end through the context of the view
    5. Dynamically generate the HTML for each post
  3. 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:
    1. Your name and andrew id
    2. The names and andrew id's of your groupmates
    3. The start/stop times you worked, and the total time you worked.
    4. Your thoughts about this exercise -- useful, interesting, etc? This will help us improve the 15-190 experience as we go.
    5. 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!