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
393a2df7
Commit
393a2df7
authored
Mar 29, 2021
by
Julia Santos
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'To-Buy' into 'master'
Users can now view all items marked as To Buy See merge request
!8
parents
b7eb640e
a514ed45
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
3 deletions
+28
-3
urls.py
Breadcrumbs/urls.py
+3
-2
views.py
Breadcrumbs/views.py
+25
-1
No files found.
Breadcrumbs/urls.py
View file @
393a2df7
...
...
@@ -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
from
.views
import
ProductListViewName
,
ProductListViewCategory
,
add_product_type
,
delete_product_type
,
ItemViewPDate
,
add_item
,
delete_item
,
ToBuyViewName
urlpatterns
=
[
url
(
r'^fridge/list/'
,
ProductListViewName
.
as_view
(),
name
=
'fridgeLN'
),
...
...
@@ -14,7 +14,8 @@ urlpatterns = [
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'
),
path
(
'fridge/<id>/add'
,
add_item
,
name
=
'add-item'
),
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'
)
]
if
settings
.
DEBUG
:
...
...
Breadcrumbs/views.py
View file @
393a2df7
...
...
@@ -40,7 +40,31 @@ class ProductListViewCategory(ListView):
def
get_queryset
(
self
):
return
Product_Type
.
objects
.
filter
(
User_ID
=
self
.
request
.
user
)
.
order_by
(
'Product_Category'
)
class
ToBuyViewName
(
ListView
):
model
=
Product_Type
template_name
=
'placeholder-list.html'
context_object_name
=
'product'
def
get_queryset
(
self
):
return
Product_Type
.
objects
.
filter
(
User_ID
=
self
.
request
.
user
)
.
filter
(
To_Buy
=
True
)
.
order_by
(
'Product_Name'
)
def
login
(
request
):
username
=
"not logged in"
if
request
.
method
==
"POST"
:
MyLoginForm
=
LoginForm
(
request
.
POST
)
if
MyLoginForm
.
is_valid
():
username
=
MyLoginForm
.
cleaned_data
[
'username'
]
#return HttpResponseRedirect('/fridge/list')
else
:
MyLoginForm
=
Loginform
()
return
render
(
request
,
loggedin
.
html
,{
"username"
:
username
})
def
add_product_type
(
request
):
context
=
{}
if
request
.
method
==
'POST'
:
...
...
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