Web Routing - Html -Sql - Hashed Passwords- User Authentification- Jinja2 - Dom Manipulation
Last week you created a pretty good site from scratch. It already has some features but it’s a bit difficult to maintain due to the fact that we store data in csv files and we also need some more features to make it more usable and more appealing to users.
The management decided to move further as users requested new features like ability to comment on answers and tag questions (and here is the issue with csv files as well). There are several other feature requests which you can find in the user stories.
As last week the management is handing out a prioritized list of new user stories that you should add to the unfinished stories from last week on your product backlog. Try to estimate these new stories as well and based on the estimations decide how many your team can finish until the demo. As the order is important, you should choose from the beginning of the list as much as you can.
psycopg2
to connect to a PostgreSQL database from Python,SELECT
, UPDATE
, DELETE
, INSERT
)As you will work in a new repository but you need the code from the previous sprint, add the ask-mate-2
repository as a new remote to the previous sprint’s repository, then pull (merge) and push your changes into it.
Make the application use a database instead of CSV files.
PSQL_USER_NAME
, PSQL_PASSWORD
, PSQL_HOST
and PSQL_DB_NAME
environment variablessample_data/askmatepart2-sample-data.sql
)Allow the user to add comments to a question.
/question/<question_id>/new-comment
pagemessage
field, and issues POST
requestsAllow the user to add comments to an answer.
/answer/<answer_id>/new-comment
pagemessage
field, and issues POST
requestsImplement searching in questions and answers. (Hint: Passing data from browser)
/search?q=<search phrase>
Allow the user to edit the posted answers.
/answer/<answer_id>/edit
pagemessage
field, and issues a POST
requestAllow the user to edit comments.
/comment/<comment_id>/edit
POST
form with a message
field<number_of_editions>
times.” next to or below the commentAllow the user to delete comments.
/comments/<comment_id>/delete
endpoint (which does not ask for confirmation anymore)Display latest 5 questions on the main page (/
).
/
) displays the latest 5 submitted questions/list
)Implement sorting for the question list. [If you did this user story in the previous sprint, now you only have to rewrite it to use SQL]
/list?order_by=title&order_direction=desc
Add tags to questions.
/question/<question_id>/new-tag
Highlight the search phrase in the search results.
Allow the user to delete tags from questions
/question/<question_id>/tag/<tag_id>/delete
endpointNone
psql
with the \i
command or run it via the Database tool in PyCharm.All data should be persisted in a PostgreSQL database in the following tables (you can ignore data in the not implemented fields):
question table
id: A unique identifier for the question
submission_time: The date and time when the question was posted
view_number: How many times this question was displayed in the single question view
vote_number: The sum of votes this question has received
title: The title of the question
message: The question text
image: the path to the image for this question
answer table
id: A unique identifier for the answer
submission_time: The date and time when the answer was posted
vote_number: The sum of votes this answer has received
question_id: The id of the question this answer belongs to
message: The answer text
image: The path to the image for this answer
tag table
id: A unique identifier for the tag
name: The name of the tag
question_tag table
question_id: The id of the question the tag belongs to
tag_id: The id of the tag belongs to the question
comment table
id: A unique identifier for the comment
question_id: The id of the question this comment belongs to (if the comment belongs to an answer, the value of this field should be NULL)
answer_id: The id of the answer this comment belongs to (if the comment belongs to a question, the value of this field should be NULL)
message: The comment text
submission_time: The date and time the comment was posted or updated
edited_number:: How many times this comment was edited
To init the database use the sample_data/askmatepart2-sample-data.sql
file in your repository.