Due: Thursday Jan 22, 23:59pm.
This homework consists in building a for-sale listing site in web2py. This is a little bit more complex than the bulletin board we have been building as a class example, but not all that much. A good approach consists in using the bulletin board code as a starting point, and add to it / modify it as necessary.
The for-sale site must allow (logged in) users to add listings. These listings should contain at least the following information:
Users should be able to:
The default view should return all items. The SQLFORM.grid will let users sort them according to date posted, price, select for category, etc.
Advice / Resources
Uploading images. Allowing users to upload images is very easy to do; read this example.
Whether an item is sold: Use a 'boolean' field type, with default False.
Price: Use a 'double' field type. Use db.forsale.price.requires = IS_FLOAT_IN_RANGE(0, 100000.0, error_message='The price should be in the range 0..100000') validator.
Contact information: This must include an email, and a phone number. Please use the validators for email and phone numbers, as described here. For email, there is a validator IS_EMAIL ready for use. For phone numbers, you can use the IS_MATCH validator defining an appropriate regular expression.
Category: Use a validator like db.forsale.category.requires = IS_IN_SET("Car", "Bike", ...) as described here.
Displaying the list of items, and adding items can be added using SQLFORM.grid, which is described here.
SQLFORM.grid can also be used to let users add items for sale.
default/index . If you cannot login, it is most likely because you are trying to access CrowdGrader using some other account (e.g. a @gmail.com account). Select login with another account.
As part of this assignment, I am asking you to review 4 other submissions by next Wednesday. A detailed grading rubric is available on CrowdGrader. Go to the assignment URL to do the reviews.