In this homework you will flesh out and organize the HTML generated by your app using templates. Specifically you will implement the following features.
- The app will use a base template which contains the overall layout of the site. The layout must include parts for the
- 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),
- the title (logo),
- the body,
- and a footer.
- 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'sfor
loop. - 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.
- 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
- HTML dog tutorials on HTML.
- Dive into HTML5 is a detailed introduction to the new HTML5 features. Many of the new features are JavaScript extensions which we will be learning about later in class. You can skim over them for now.
- Templates tutorial
- Django templates referene
For part 4. a seasoned developer would use a regular expressions http://docs.python.org/library/re.html
ReplyDeleteIf you don't feel up to that, just make sure the user does not put any spaces or / in his username. Use 'in'.
Also, don't let a user pick a name that is being used by another user.
ReplyDeleteIn the directions for the homework, it says we should have a title(logo). By logo are you referring to a photo?
ReplyDeleteIf we already know how, can we just use Javascript for validating the field input?
ReplyDeleteFor now, the title is just a placeholder. A text title is fine, for example, "Surveys-R-Us".
ReplyDeleteYou 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 ...