Commit 24496d71 authored by Julia Santos's avatar Julia Santos

Added an edit page for product types

parent 821c1f2d
......@@ -4,7 +4,7 @@ from django.conf.urls.static import static
from django.views.generic import TemplateView
from django.urls import include, path
from Breadcrumbs import views
from .views import ProductListViewName, ProductListViewCategory, add_product_type, delete_product_type, ItemViewPDate, add_item, delete_item, ToBuyViewName, UnmarkToBuy
from .views import ProductListViewName, ProductListViewCategory, add_product_type, delete_product_type, ItemViewPDate, add_item, delete_item, ToBuyViewName, UnmarkToBuy, editProductType
urlpatterns = [
url(r'^fridge/list/', ProductListViewName.as_view(), name='fridgeLN'),
......@@ -17,6 +17,7 @@ urlpatterns = [
path('fridge/<id>/<id2>/delete', delete_item, name = 'delete-item'),
url(r'^to-buy/', ToBuyViewName.as_view(), name = 'to-buyLN'),
path('fridge/<int:pk>/update', UnmarkToBuy.as_view(), name = 'to-buy-unmark'),
path('fridge/<int:pk>/edit', editProductType.as_view(), name = 'edit-product-type'),
]
if settings.DEBUG:
......
......@@ -166,3 +166,9 @@ class UnmarkToBuy(UpdateView):
fields = ['To_Buy']
template_name = 'unmark.html'
success_url = 'http://127.0.0.1:8000/to-buy/'
class editProductType(UpdateView):
model = Product_Type
fields = ['Product_Name','Product_Category','Icon','To_Buy']
template_name = 'unmark.html'
success_url = 'http://127.0.0.1:8000/fridge/list'
\ No newline at end of file
......@@ -66,7 +66,7 @@
</div>
<div class = "listEdit">
<a href = "http://127.0.0.1:8000/fridge/{{product.Product_ID}}/update">
<a href = "http://127.0.0.1:8000/fridge/{{product.Product_ID}}/edit">
<div class = "black">EDIT</div></a>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment