part (i) marking scheme:
- @login_required is the decorator (1 mark) provided by the Flask-login extension (1 mark) to ensure only logged in users can access this view
- Flask uses the request object (1 mark) to store submitted data; request.args is used for data submitted via a GET request (1 mark); the id identifies the blog post to be deleted (1 mark)
- redirect means that the application sends an HTTP status code (1 mark) that tells the browser to redirect to a new URL (1 mark)
- url_for generates the url for a Flask view (in this case, the 'index' view) (1 mark)
- missing from the code is any message to the user to communicate the success or failure of the delete operation (1 mark)
Maximum 6 marks.
Notice that in this case there are 9 elements in the answer scheme for which a mark can be awarded (up to the maximum of 6 marks for the section). So it's worth putting down whatever you think might be relevant, in case it will attract a mark