Friday, September 21, 2012

HW5: Boards

In this homework you will extend upon the previous database model by adding a Board. Basically, a user can create any number boards. Each board has a title, which the user can set. The user can add any number of his pins to any one of his boards (a pin can be in more than one board).

The user will also be able edit his board after creating it. He is able to edit the title, add and delete pins, and set it to private or not. If a board or pin is marked 'private' then only its owner can see it, if it is not marked private then everyone can see it (but still, only the owner can edit it).

A non-owner of a board can still see it, but cannot see the edit controls, nor can he edit it via direct POSTs (security).

The screenshots here provide a guide as to how your app will look like.

GET /when logged-in, shows links to "My Pins" (/pin) and "My Boards" (/board)
GET /pinlists all the users' pins and links us to each one, as before. Also, this page should let the user add a new pin.
POST /pincreates a new pin, as before
GET /pin/123shows pin 123, and a form for editing it, as before.
POST /pin/123updates pin 123 (caption or url), or deletes it, as before.
GET /boardlists all my boards. If not logged in re-direct to /, and do similarly for all the other URLs. Also, this page should let the user add a new board.
POST /boardCreates a new board and then redirects the user to it.
GET /board/123If my board then list all the pins in the board and a form for editing it. If not mine but public then list the pins in the board. If not mine and private then re-direct to /
POST /board/123Update board 123's information. The possible changes are: new title, add pin, delete pin, mark as private/public, delete board. Then redirect the user back to GET /board/123

Required Reading


This homework makes more use of the datastore, so you will need to continue using the datastore documenation

For storing the list of pins in a board I suggest you use the ListProperty on a Board. However, you can also use a mapping table, as is often done when one wants to implement a many-to-many relationship in a database (for those of you who have taken 520). In any case, you will need to be careful that when a pin is deleted from a board that the pin is no longer listed as belonging to that board.

As I will explain in class, these type of data-consistency checks are best implemented as methods to your Model class.

Push your final changes to your private github repo and publish your app to appspot.com by Monday, October 1 @9am.

1 comment: