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 ...@@ -4,7 +4,7 @@ from django.conf.urls.static import static
from django.views.generic import TemplateView from django.views.generic import TemplateView
from django.urls import include, path from django.urls import include, path
from Breadcrumbs import views 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 = [ urlpatterns = [
url(r'^fridge/list/', ProductListViewName.as_view(), name='fridgeLN'), url(r'^fridge/list/', ProductListViewName.as_view(), name='fridgeLN'),
...@@ -17,6 +17,7 @@ urlpatterns = [ ...@@ -17,6 +17,7 @@ urlpatterns = [
path('fridge/<id>/<id2>/delete', delete_item, name = 'delete-item'), path('fridge/<id>/<id2>/delete', delete_item, name = 'delete-item'),
url(r'^to-buy/', ToBuyViewName.as_view(), name = 'to-buyLN'), 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>/update', UnmarkToBuy.as_view(), name = 'to-buy-unmark'),
path('fridge/<int:pk>/edit', editProductType.as_view(), name = 'edit-product-type'),
] ]
if settings.DEBUG: if settings.DEBUG:
......
...@@ -165,4 +165,10 @@ class UnmarkToBuy(UpdateView): ...@@ -165,4 +165,10 @@ class UnmarkToBuy(UpdateView):
model = Product_Type model = Product_Type
fields = ['To_Buy'] fields = ['To_Buy']
template_name = 'unmark.html' template_name = 'unmark.html'
success_url = 'http://127.0.0.1:8000/to-buy/' success_url = 'http://127.0.0.1:8000/to-buy/'
\ No newline at end of file
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 @@ ...@@ -66,7 +66,7 @@
</div> </div>
<div class = "listEdit"> <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 class = "black">EDIT</div></a>
</div> </div>
</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