Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
Hunger Buster - Breadcrumbs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Julia Santos
Hunger Buster - Breadcrumbs
Commits
2c6e3121
Commit
2c6e3121
authored
Mar 23, 2021
by
Julia Santos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Users can now delete items under a specific product type
parent
e04ba2de
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
3 deletions
+16
-3
placeholder-items.html
Breadcrumbs/templates/placeholder-items.html
+1
-1
urls.py
Breadcrumbs/urls.py
+2
-1
views.py
Breadcrumbs/views.py
+13
-1
No files found.
Breadcrumbs/templates/placeholder-items.html
View file @
2c6e3121
...
@@ -77,7 +77,7 @@
...
@@ -77,7 +77,7 @@
{{item.Is_Expired}}
{{item.Is_Expired}}
</th>
</th>
<th>
<th>
<a
href=
'http://127.0.0.1:8000/fridge/{{item.Item_ID}}/delete'
>
Delete?
</a>
<a
href=
'http://127.0.0.1:8000/fridge/{{item.
Product_ID}}/{{item.
Item_ID}}/delete'
>
Delete?
</a>
</th>
</th>
</tr>
</tr>
...
...
Breadcrumbs/urls.py
View file @
2c6e3121
...
@@ -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
from
.views
import
ProductListViewName
,
ProductListViewCategory
,
add_product_type
,
delete_product_type
,
ItemViewPDate
,
add_item
,
delete_item
urlpatterns
=
[
urlpatterns
=
[
url
(
r'^fridge/list/'
,
ProductListViewName
.
as_view
(),
name
=
'fridgeLN'
),
url
(
r'^fridge/list/'
,
ProductListViewName
.
as_view
(),
name
=
'fridgeLN'
),
...
@@ -16,6 +16,7 @@ urlpatterns = [
...
@@ -16,6 +16,7 @@ urlpatterns = [
path
(
'fridge/<id>/delete'
,
delete_product_type
,
name
=
'product-type-delete'
),
path
(
'fridge/<id>/delete'
,
delete_product_type
,
name
=
'product-type-delete'
),
url
(
r'^fridge/(?P<Product_ID>\d+)/$'
,
ItemViewPDate
.
as_view
(),
name
=
'item-purchase-date-view'
),
url
(
r'^fridge/(?P<Product_ID>\d+)/$'
,
ItemViewPDate
.
as_view
(),
name
=
'item-purchase-date-view'
),
path
(
'fridge/<id>/add'
,
add_item
,
name
=
'add-item'
),
path
(
'fridge/<id>/add'
,
add_item
,
name
=
'add-item'
),
path
(
'fridge/<id>/<id2>/delete'
,
delete_item
,
name
=
'delete-item'
)
]
]
if
settings
.
DEBUG
:
if
settings
.
DEBUG
:
...
...
Breadcrumbs/views.py
View file @
2c6e3121
...
@@ -124,4 +124,16 @@ def add_item(request, id):
...
@@ -124,4 +124,16 @@ def add_item(request, id):
else
:
else
:
form
=
AddItemForm
()
form
=
AddItemForm
()
context
[
'form'
]
=
form
context
[
'form'
]
=
form
return
render
(
request
,
'add-item.html'
,
context
)
return
render
(
request
,
'add-item.html'
,
context
)
\ No newline at end of file
def
delete_item
(
request
,
id
,
id2
):
context
=
{}
item
=
get_object_or_404
(
Item
,
Item_ID
=
id2
)
prod_type
=
item
.
Product_ID
if
request
.
method
==
"POST"
:
item
.
delete
()
return
HttpResponseRedirect
(
"/fridge/"
+
str
(
prod_type
))
return
render
(
request
,
'product-type-confirm-delete.html'
,
context
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment