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
11ef102e
Commit
11ef102e
authored
Mar 16, 2021
by
Julia Santos
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Login' into 'master'
Login See merge request
!3
parents
d09485d4
41400cd4
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
320 additions
and
21 deletions
+320
-21
mainFridgeList.css
Breadcrumbs/static/mainFridgeList.css
+70
-0
sidebar.css
Breadcrumbs/static/sidebar.css
+80
-0
add-product-type.html
Breadcrumbs/templates/add-product-type.html
+41
-1
placeholder-list.html
Breadcrumbs/templates/placeholder-list.html
+50
-4
product-type-confirm-delete
Breadcrumbs/templates/product-type-confirm-delete
+4
-0
product-type-confirm-delete.html
Breadcrumbs/templates/product-type-confirm-delete.html
+8
-0
login.html
Breadcrumbs/templates/registration/login.html
+7
-1
urls.py
Breadcrumbs/urls.py
+6
-3
views.py
Breadcrumbs/views.py
+36
-4
mainFridgeList.css
HTML and CSS Files/mainFridgeList.css
+17
-7
settings.py
HungerBuster/settings.py
+1
-1
No files found.
Breadcrumbs/static/mainFridgeList.css
0 → 100644
View file @
11ef102e
body
{
width
:
100%
;
height
:
100%
;
margin
:
0px
;
}
.listViewHeader
{
background-color
:
rgba
(
40
,
40
,
40
,
1
);
width
:
100vw
;
color
:
white
;
text-align
:
left
;
}
.breadcrumbsHead
{
font-family
:
"Roboto Bold"
;
font-size
:
46px
;
margin-left
:
50px
;
}
.lowerPage
{
width
:
100vw
;
display
:
grid
;
grid-template-columns
:
repeat
(
6
,
16.67vw
);
text-align
:
left
;
}
.sidebar
{
background-color
:
rgba
(
196
,
196
,
196
,
1
);
display
:
grid
;
grid-template-rows
:
repeat
(
16
,
6.25vh
);
grid-column
:
1
/
2
;
}
.sideItem
{
grid-template-columns
:
repeat
(
2
,
12.5vw
);
text-align
:
center
;
background-color
:
rgba
(
104
,
104
,
104
,
1
);
}
.text
{
font-family
:
"Roboto"
;
font-size
:
24px
;
color
:
white
;
grid-column
:
2
/
3
;
}
.icon
{
grid-column
:
1
/
2
;
}
.circle
{
margin
:
5px
;
clip-path
:
circle
();
background-color
:
white
;
}
.fridge
{
grid-row
:
3
/
4
;
}
.recipes
{
grid-row
:
6
/
7
;
}
.stats
{
grid-row
:
9
/
10
;
}
.toBuy
{
grid-row
:
12
/
13
;
}
@font-face
{
font-family
:
Roboto
Bold
;
src
:
url(Roboto-Bold.ttf)
;
}
@font-face
{
font-family
:
Roboto
;
src
:
url(Roboto-Regular.ttf)
;
}
\ No newline at end of file
Breadcrumbs/static/sidebar.css
0 → 100644
View file @
11ef102e
body
{
width
:
100%
;
height
:
100%
;
margin
:
0px
;
}
.listViewHeader
{
background-color
:
rgba
(
40
,
40
,
40
,
1
);
width
:
100vw
;
color
:
white
;
text-align
:
left
;
}
.breadcrumbsHead
{
font-family
:
"Roboto Bold"
;
font-size
:
46px
;
margin-left
:
50px
;
}
.lowerPage
{
width
:
100vw
;
display
:
grid
;
grid-template-columns
:
repeat
(
6
,
16.67vw
);
text-align
:
left
;
}
.sidebar
{
height
:
100%
;
position
:
fixed
;
width
:
265px
;
background-color
:
rgba
(
196
,
196
,
196
,
1
);
display
:
grid
;
grid-template-rows
:
repeat
(
16
,
6.25vh
);
grid-column
:
1
/
2
;
z-index
:
1
;
left
:
0
;
}
.sideItem
{
grid-template-columns
:
repeat
(
2
,
12.5vw
);
text-align
:
center
;
background-color
:
rgba
(
104
,
104
,
104
,
1
);
}
.text
{
font-family
:
"Roboto"
;
font-size
:
24px
;
color
:
white
;
grid-column
:
2
/
3
;
}
.icon
{
grid-column
:
1
/
2
;
}
.circle
{
margin
:
5px
;
clip-path
:
circle
();
background-color
:
white
;
}
.fridge
{
grid-row
:
3
/
4
;
}
.recipes
{
grid-row
:
6
/
7
;
}
.stats
{
grid-row
:
9
/
10
;
}
.toBuy
{
grid-row
:
12
/
13
;
}
@font-face
{
font-family
:
Roboto
Bold
;
src
:
url(Roboto-Bold.ttf)
;
}
@font-face
{
font-family
:
Roboto
;
src
:
url(Roboto-Regular.ttf)
;
}
.main
{
margin-left
:
23%
;
}
\ No newline at end of file
Breadcrumbs/templates/add-product-type.html
View file @
11ef102e
<!DOCTYPE html>
<!DOCTYPE html>
<html
lang=
"en"
>
<html
lang=
"en"
>
{% load static %}
<link
rel=
"stylesheet"
href=
"{%static "
sidebar
.
css
"
%}"
>
<head>
<head>
<meta
charset=
"UTF-8"
>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
Add Product Type
</title>
<title>
Add Product Type
</title>
</head>
</head>
<body>
<body>
<div
class =
"listViewHeader"
>
<div
class =
"breadcrumbsHead"
>
BREADCRUMBS
</div>
</div>
<div
class =
"lowerPage"
>
<div
class =
"sidebar"
>
<div
class =
"sideItem text fridge"
>
FRIDGE
</div>
<div
class =
"sideItem icon fridge"
>
<div
class =
"circle"
>
:3
</div>
</div>
<div
class =
"sideItem text recipes"
>
RECIPES
</div>
<div
class =
"sideItem icon recipes"
>
<div
class =
"circle"
>
:3
</div>
</div>
<div
class =
"sideItem text stats"
>
STATS
</div>
<div
class =
"sideItem icon stats"
>
<div
class =
"circle"
>
:3
</div>
</div>
<div
class =
"sideItem text toBuy"
>
TO BUY
</div>
<div
class =
"sideItem icon toBuy"
>
<div
class =
"circle"
>
:3
</div>
</div>
</div>
</div>
<h3>
Add Product Type
</h3>
<h3>
Add Product Type
</h3>
<form
method=
"POST"
enctype=
"multipart/form-data"
>
<form
method=
"POST"
enctype=
"multipart/form-data"
div
class=
"main"
>
{% csrf_token %}
{% csrf_token %}
{{ form.as_p }}
{{ form.as_p }}
<input
type=
"submit"
value=
"Submit"
>
<input
type=
"submit"
value=
"Submit"
>
</form>
</form>
<a
href=
"http://127.0.0.1:8000/fridge/list"
div
class=
"main"
>
Back
</a>
</body>
</body>
</html>
</html>
\ No newline at end of file
Breadcrumbs/templates/placeholder-list.html
View file @
11ef102e
<html>
<html>
<title>
Fridge
</title>
<title>
Fridge
</title>
{% load static %}
{% load static %}
<link
rel=
"stylesheet"
href=
"{%static "
sidebar
.
css
"
%}"
>
{% block content %}
{% block content %}
<style>
<style>
table
,
th
,
td
{
table
,
th
,
td
{
border
:
1px
solid
black
;
border
:
1px
solid
black
;
}
}
</style>
</style>
<div
class =
"listViewHeader"
>
<div
class =
"breadcrumbsHead"
>
BREADCRUMBS
</div>
</div>
<div
class =
"lowerPage"
>
<div
class =
"sidebar"
>
<div
class =
"sideItem text fridge"
>
FRIDGE
</div>
<div
class =
"sideItem icon fridge"
>
<div
class =
"circle"
>
:3
</div>
</div>
<div
class =
"sideItem text recipes"
>
RECIPES
</div>
<div
class =
"sideItem icon recipes"
>
<div
class =
"circle"
>
:3
</div>
</div>
<div
class =
"sideItem text stats"
>
STATS
</div>
<div
class =
"sideItem icon stats"
>
<div
class =
"circle"
>
:3
</div>
</div>
<div
class =
"sideItem text toBuy"
>
TO BUY
</div>
<div
class =
"sideItem icon toBuy"
>
<div
class =
"circle"
>
:3
</div>
</div>
</div>
</div>
<h2>
Fridge
</h2>
<h2>
Fridge
</h2>
<table
style=
"width:100%"
>
<tr><th></th><th>
name
</th><th>
category
</th><th>
description
</th><th>
to buy?
</th><th>
user
</th></tr>
<table
style=
"width:70%"
div
class=
"main"
>
<tr><th
colspan=
"5"
><a
href=
"http://127.0.0.1:8000/fridge/add/"
>
Add Item
</a></th></tr>
<tr><th></th>
<th><a
href=
"http://127.0.0.1:8000/fridge/list/"
>
name
</a></th>
<th><a
href=
"http://127.0.0.1:8000/fridge/list-category"
>
category
</a></th>
<th>
description
</th>
<th>
to buy?
</th>
<th>
user
</th>
</tr>
{% for product in object_list %}
{% for product in object_list %}
<tr>
<tr>
<th>
<th>
<img
src =
"{{product.Icon.url}}"
width =
"100"
height =
"100"
>
<img
src =
"{{product.Icon.url}}"
width =
"100"
height =
"100"
>
</th>
</th>
<th>
<th>
{{product.Product_Name}}
{{product.Product_Name}}
</th>
</th>
<th>
<th>
{{product.Product_Category}}
{{product.Product_Category}}
...
@@ -28,7 +74,7 @@
...
@@ -28,7 +74,7 @@
{{product.To_Buy}}
{{product.To_Buy}}
</th>
</th>
<th>
<th>
{{product.User_ID.username}}
<a
href=
'http://127.0.0.1:8000/fridge/{{product.Product_ID}}/delete'
>
Delete?
</a>
</th>
</th>
</tr>
</tr>
{% endfor %}
{% endfor %}
...
...
Breadcrumbs/templates/product-type-confirm-delete
0 → 100644
View file @
11ef102e
<form method="post">{% csrf_token %}
<p>Are you sure you want to delete "{{ object }}"?</p>
<input type="submit" value="Confirm">
</form>
Breadcrumbs/templates/product-type-confirm-delete.html
0 → 100644
View file @
11ef102e
<html>
<body>
<form
method=
"post"
>
{% csrf_token %}
<p>
Are you sure you want to delete "{{ object }}"?
</p>
<input
type=
"submit"
value=
"Confirm"
>
</form>
</body>
</html>
Breadcrumbs/templates/registration/login.html
View file @
11ef102e
<h2>
Log In
</h2>
{% load static %}
<link
rel=
"stylesheet"
href=
"{%static "
sidebar
.
css
"
%}"
>
<div
class =
"listViewHeader"
>
<div
class =
"breadcrumbsHead"
>
BREADCRUMBS
</div>
</div>
<form
method=
"post"
>
<form
method=
"post"
>
{% csrf_token %}
{% csrf_token %}
{{ form.as_p }}
{{ form.as_p }}
...
...
Breadcrumbs/urls.py
View file @
11ef102e
...
@@ -4,13 +4,16 @@ from django.conf.urls.static import static
...
@@ -4,13 +4,16 @@ 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
ProductListView
,
add_product_type
from
.views
import
ProductListView
Name
,
ProductListViewCategory
,
add_product_type
,
delete_product_type
#ProductTypeDeleteView
urlpatterns
=
[
urlpatterns
=
[
url
(
r'^fridge/list/'
,
ProductListView
.
as_view
(),
name
=
'fridgeL'
),
url
(
r'^fridge/list/'
,
ProductListViewName
.
as_view
(),
name
=
'fridgeLN'
),
url
(
r'^fridge/list-category'
,
ProductListViewCategory
.
as_view
(),
name
=
'fridgeLC'
),
url
(
'accounts/'
,
include
(
'django.contrib.auth.urls'
)),
url
(
'accounts/'
,
include
(
'django.contrib.auth.urls'
)),
#url('', ProductListView.as_view(), name='home'),
#url('', ProductListView.as_view(), name='home'),
path
(
'fridge/add/'
,
add_product_type
,
name
=
'product-type-form'
)
path
(
'fridge/add/'
,
add_product_type
,
name
=
'product-type-form'
),
#path('fridge/<pk>/delete', ProductTypeDeleteView.as_view()),
path
(
'fridge/<id>/delete'
,
delete_product_type
,
name
=
'product-type-delete'
),
]
]
if
settings
.
DEBUG
:
if
settings
.
DEBUG
:
...
...
Breadcrumbs/views.py
View file @
11ef102e
from
django.views.generic
import
ListView
from
django.views.generic
import
ListView
from
.models
import
User
,
Product_Type
,
Item
,
Recipe
from
django.db.models
import
Q
from
django.db.models
import
Q
from
.forms
import
LoginForm
,
ProductTypeForm
from
.forms
import
LoginForm
,
ProductTypeForm
from
django.http
import
HttpResponseRedirect
from
django.http
import
HttpResponseRedirect
from
django.shortcuts
import
render
from
django.shortcuts
import
render
,
get_object_or_404
from
django.views.generic.edit
import
DeleteView
from
.models
import
User
,
Product_Type
,
Item
,
Recipe
#class UserListView(ListView):
#class UserListView(ListView):
# model = User
# model = User
...
@@ -12,7 +15,7 @@ from django.shortcuts import render
...
@@ -12,7 +15,7 @@ from django.shortcuts import render
# def get_queryset(self):
# def get_queryset(self):
# return User.objects.all().order_by('User_ID')
# return User.objects.all().order_by('User_ID')
#User = settings.AUTH_USER_MODEL
#User = settings.AUTH_USER_MODEL
class
ProductListView
(
ListView
):
class
ProductListView
Name
(
ListView
):
model
=
Product_Type
model
=
Product_Type
template_name
=
'placeholder-list.html'
template_name
=
'placeholder-list.html'
context_object_name
=
'product'
context_object_name
=
'product'
...
@@ -20,6 +23,15 @@ class ProductListView(ListView):
...
@@ -20,6 +23,15 @@ class ProductListView(ListView):
def
get_queryset
(
self
):
def
get_queryset
(
self
):
return
Product_Type
.
objects
.
filter
(
User_ID
=
self
.
request
.
user
)
.
order_by
(
'Product_Name'
)
return
Product_Type
.
objects
.
filter
(
User_ID
=
self
.
request
.
user
)
.
order_by
(
'Product_Name'
)
class
ProductListViewCategory
(
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
)
.
order_by
(
'Product_Category'
)
def
login
(
request
):
def
login
(
request
):
username
=
"not logged in"
username
=
"not logged in"
...
@@ -28,7 +40,7 @@ def login(request):
...
@@ -28,7 +40,7 @@ def login(request):
if
MyLoginForm
.
is_valid
():
if
MyLoginForm
.
is_valid
():
username
=
MyLoginForm
.
cleaned_data
[
'username'
]
username
=
MyLoginForm
.
cleaned_data
[
'username'
]
return
HttpResponseRedirect
(
'/fridge/list'
)
#
return HttpResponseRedirect('/fridge/list')
else
:
else
:
MyLoginForm
=
Loginform
()
MyLoginForm
=
Loginform
()
...
@@ -54,3 +66,23 @@ def add_product_type(request):
...
@@ -54,3 +66,23 @@ def add_product_type(request):
context
[
'form'
]
=
form
context
[
'form'
]
=
form
return
render
(
request
,
'add-product-type.html'
,
context
)
return
render
(
request
,
'add-product-type.html'
,
context
)
def
delete_product_type
(
request
,
id
):
context
=
{}
obj
=
get_object_or_404
(
Product_Type
,
Product_ID
=
id
)
if
request
.
method
==
"POST"
:
obj
.
delete
()
return
HttpResponseRedirect
(
"/fridge/list/"
)
return
render
(
request
,
'product-type-confirm-delete.html'
,
context
)
# class ProductTypeDeleteView(DeleteView):
# models = Product_Type
# template_name = 'product-type-confirm-delete.html'
# success_url = 'fridge/list/'
# def get_object(self, queryset=None):
# obj = super(ProductTypeDeleteView, self).get_object()
# if not obj.owner == self.request.user:
# raise Http404
# return obj
\ No newline at end of file
HTML and CSS Files/mainFridgeList.css
View file @
11ef102e
body
{
body
{
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
margin
:
0px
;
margin
:
0px
;
}
}
.listViewHeader
{
.listViewHeader
{
...
@@ -23,10 +23,16 @@ body {
...
@@ -23,10 +23,16 @@ body {
text-align
:
left
;
text-align
:
left
;
}
}
.sidebar
{
.sidebar
{
height
:
100%
;
position
:
fixed
;
width
:
265px
;
background-color
:
rgba
(
196
,
196
,
196
,
1
);
background-color
:
rgba
(
196
,
196
,
196
,
1
);
display
:
grid
;
display
:
grid
;
grid-template-rows
:
repeat
(
16
,
6.25vh
);
grid-template-rows
:
repeat
(
16
,
6.25vh
);
grid-column
:
1
/
2
;
grid-column
:
1
/
2
;
z-index
:
1
;
left
:
0
;
}
}
.sideItem
{
.sideItem
{
grid-template-columns
:
repeat
(
2
,
12.5vw
);
grid-template-columns
:
repeat
(
2
,
12.5vw
);
...
@@ -61,10 +67,14 @@ body {
...
@@ -61,10 +67,14 @@ body {
}
}
@font-face
{
@font-face
{
font-family
:
Roboto
Bold
;
font-family
:
Roboto
Bold
;
src
:
url(Roboto-Bold.ttf)
;
src
:
url(Roboto-Bold.ttf)
;
}
}
@font-face
{
@font-face
{
font-family
:
Roboto
;
font-family
:
Roboto
;
src
:
url(Roboto-Regular.ttf)
;
src
:
url(Roboto-Regular.ttf)
;
}
.main
{
margin-left
:
23%
;
}
}
\ No newline at end of file
HungerBuster/settings.py
View file @
11ef102e
...
@@ -130,4 +130,4 @@ MEDIA_URL = '/media/'
...
@@ -130,4 +130,4 @@ MEDIA_URL = '/media/'
MEDIA_ROOT
=
os
.
path
.
join
(
BASE_DIR
,
'media'
)
MEDIA_ROOT
=
os
.
path
.
join
(
BASE_DIR
,
'media'
)
#for login
#for login
#LOGIN_REDIRECT_uRL = '
/'
LOGIN_REDIRECT_URL
=
'/fridge/list
/'
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