Monday, January 31, 2011

HW3: HTML and Templates

In this homework you will flesh out and organize the HTML generated by your app using templates. Specifically you will implement the following features.

  1. The app will use a base template which contains the overall layout of the site. The layout must include parts for the
    1. login-bar (that bar at the top that shows your username and lets you logout, if you are logged in, or lets you log in if you are not),
    2. the title (logo),
    3. the body,
    4. and a footer.
    You can add other sections if you want.
  2. Create a new page, /user, which provides a list of all users (their names) that have created accounts in the site. This template must use the template's for loop.
  3. Change the app to make it impossible for a user to change his name to a name that has spaces or other non-url friendly characters.
  4. Make it so the page /user/<username> takes us to a page that shows us the user's name. In a later homework, you will write code to show the user's questions in this page.

The homework is due on Monday, February 7 @11am, you can turn it in here.

Required Reading

UPDATE: See my 'comments' below.


  1. For part 4. a seasoned developer would use a regular expressions

    If you don't feel up to that, just make sure the user does not put any spaces or / in his username. Use 'in'.

  2. Also, don't let a user pick a name that is being used by another user.

  3. In the directions for the homework, it says we should have a title(logo). By logo are you referring to a photo?

  4. If we already know how, can we just use Javascript for validating the field input?

  5. For now, the title is just a placeholder. A text title is fine, for example, "Surveys-R-Us".

    You must validate usernames at the server side, but you can also do client-side validation if you want to. This is standard practice in webapps. You can NEVER TRUST that what the client is sending you is clean since they might by POSTing directly to your webserver, without going thru your javascript, or using a greasemonkey script, or ...