DeeMcCart / CI_PP5_Jeweller

Jewellery website for CI Project 5

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

User Story: SO_08, SO_09, SO_10 System Admin - Products

DeeMcCart opened this issue · comments

EPIC: #34

  • SO_08 As System Owner I want to create and maintain product categories to assist in sorting and filtering for users
  • SO_09 As System Owner I want to create and maintain products to administer the site and keep it current
  • SO_10 As System Owner I want to identify make-to-order/custom products as well as off-the-shelf products to advertise both business streams

Assumptions or Pre-Requisites:

  • Core part of system is constructed with Products app installed and base functionality working #1

Acceptance Criteria: (Must be completed before task is moved to 'Done')

  • (System admin only) must be able to add products via a front-end screen
  • (System admin only) must be able to edit products via a front-end screen

Tasks

  • ADD PRODUCT:
  • Task1 products/forms.py
  • Task2 products/views.py def add_product(request)
  • Task3 products/urls.py path('add/', view.add_product, name='add_product')
  • Task4 add_product.html
  • Task5 TEST add product
  • EDIT PRODUCT:
  • Task6 products/views.py def edit_product(request)
  • Task7 products/templates/product/ edit_product.html
  • Task8 URLs.py path('edit/int:product_id/', views.edit_product, name='edit_product')
  • Task9 URLS.py path('delete/int:product_id/', views.delete_product, name='delete_product')
  • DELETE PRODUCT:
  • Task10 products/views.py def delete_product(request)
  • Task11 includes/nav-profile.html dropdown to
  • Task12 Add edit and delete links in appropriate places (where the product id is known) ie product card
    {% if request.user.is_superuser %}
    Edit
    Delete {% endif %}
  • APPLY SECURITY:
  • Task 13 Protect the URLs for edit and delete so that these cant be accessed directly by someone other than sysadmin. Also check within each function that the currently logged in user is a superuser, otherwise return them to the home page.
  • IMPROVE IMAGE FILE UX:
  • Task14 (Ref 'Fixing the Image Field - Part 1') To cleanup display of product images in the add/edit/delete screen (because they do look truly shite) Create a file Products/widgets.py and import some widgets and lazy text handler. This refers to a template Products/custom_widget_templates/custom_clearable_file_input.html. ...... EVENTUAL SUCCESS WHEN FORM FIELDS DISPLAYED INDIVIDUALLY
  • Task15 Add content to this, and on the Products/forms.py refer to the template for the image in class ProductForm.
  • Task 16 TEST

DMcC 08/02/24 Need to revert to the 'Fixing the Image field lessons Part 1/2' as this holds the solution for visibility of images on Product add/ but more particularly on Product Edit.

Would really like to enhance this by offering a grid view for product add/edit/delete.
Would also like to enhance this by offering a delete confirmation message, as it is quite scary that a product could inadvertently be removed from the database (and it would be hard to recreate it and see it, for example, on existing orders)

DMcC 12/02/24: Closing out this issue in end-of-sprint3 review:
Tested through end-to-end and works fine but could do with some refinement (in Sprint 4):
Added task #55 under UX to tidy up:

  • Confirm delete message
  • deal with the situation where the product is deleted and the historical order is displayed (currently the item description disappears/shows blank and the order total shows 0)

(Note that this will also deal with the situation where an item price is updated as otherwise that would update all previous orders to the new price) . Closing out this issue 12/02/24