Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_father when can i be on my own i have the hello world to see
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
father when can i be on my own i have the hello world to see
widget_father when can i be on my own i have the hello world to see
Commits
113e781b
Commit
113e781b
authored
May 13, 2022
by
Charles Lim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created base.html and base css for homepage app
parent
521cdd5e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
92 additions
and
34 deletions
+92
-34
.gitignore
.gitignore
+1
-0
widgetuser_detail.html
homepage/templates/homepage/widgetuser_detail.html
+11
-0
index.html
homepage/templates/index.html
+11
-0
urls.py
homepage/urls.py
+4
-3
views.py
homepage/views.py
+11
-29
settings.py
..._i_be_on_my_own_i_have_the_hello_world_to_see/settings.py
+4
-2
base_style.css
...y_own_i_have_the_hello_world_to_see/static/base_style.css
+26
-0
base.html
..._my_own_i_have_the_hello_world_to_see/templates/base.html
+24
-0
No files found.
.gitignore
View file @
113e781b
...
...
@@ -11,6 +11,7 @@ media
# Environments
.env
/widgetenv
# .vscode
.vscode
...
...
homepage/templates/homepage/widgetuser_detail.html
0 → 100644
View file @
113e781b
<!-- homepage/widgetuser_detail.html -->
{% extends 'base.html' %}
{% block title %}Homepage{% endblock %}
{% block content %}
<p>
{{object.last_name}}, {{object.first_name}} {{object.middle_name}}
</p>
<p>
{{object.id_num}}
</p>
<p>
{{object.email}}
</p>
<p>
{{object.department.home_unit}}, {{object.department.dept_name}}
</p>
{% endblock %}
\ No newline at end of file
homepage/templates/index.html
0 → 100644
View file @
113e781b
<!-- homepage/index.html -->
{% extends 'base.html' %}
{% block title %}Homepage{% endblock %}
{% block styles %}
{% endblock %}
{% block content %}
<h1>
Welcome to Widget!
</h1>
{% for user in all_widgetusers %}
<a
href=
"{{user.id}}/details"
>
{{forloop.counter}}. {{user.last_name}}, {{user.first_name}} {{user.middle_name}}
</a>
</br>
{% endfor %}
{% endblock %}
\ No newline at end of file
homepage/urls.py
View file @
113e781b
from
django.urls
import
path
from
.views
import
index
from
.views
import
HomepageView
,
WidgetUserDetailView
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
''
,
HomepageView
.
as_view
(),
name
=
'index'
),
path
(
'<int:pk>/details'
,
WidgetUserDetailView
.
as_view
(),
name
=
'widgetuser_detail'
),
]
app_name
=
"homepage"
\ No newline at end of file
app_name
=
"homepage"
homepage/views.py
View file @
113e781b
from
django.shortcuts
import
render
from
django.views
import
View
from
django.views.generic.detail
import
DetailView
from
.models
import
Department
,
WidgetUser
from
forum.views
import
display_forumposts
from
.models
import
WidgetUser
,
Department
from
django.http
import
HttpResponse
def
index
(
request
):
return
HttpResponse
(
display_homepage
(
WidgetUser
.
objects
.
all
(),
Department
.
objects
.
all
()))
class
HomepageView
(
View
):
def
get
(
self
,
request
):
objects_set
=
{
"all_widgetusers"
:
[
obj
for
obj
in
WidgetUser
.
objects
.
all
()
.
order_by
(
'last_name'
)]
}
return
render
(
request
,
'index.html'
,
objects_set
)
# View for HomePage
def
display_homepage
(
widgetuser_data
,
department_data
):
display_output
=
"WIDGET USERS: <br>"
for
object
in
widgetuser_data
:
first_name
=
object
.
first_name
middle_name
=
object
.
middle_name
last_name
=
object
.
last_name
id_num
=
object
.
id_num
department_object
=
Department
.
objects
.
filter
(
id
=
object
.
department_id
)
.
first
()
if
(
department_object
!=
None
):
dept_name
=
department_object
.
dept_name
home_unit
=
department_object
.
home_unit
else
:
dept_name
=
"NONE"
home_unit
=
"NONE"
display_output
+=
f
'''
{last_name}, {first_name} {middle_name}: {id_num}, {dept_name}, {home_unit}<br>
'''
return
display_output
class
WidgetUserDetailView
(
DetailView
):
model
=
WidgetUser
widget_father_when_can_i_be_on_my_own_i_have_the_hello_world_to_see/settings.py
View file @
113e781b
...
...
@@ -42,10 +42,11 @@ INSTALLED_APPS = [
'django.contrib.sessions'
,
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
'widget_father_when_can_i_be_on_my_own_i_have_the_hello_world_to_see'
,
'forum'
,
'assignments'
,
'homepage'
,
'announcement_board'
,
'announcement_board'
]
MIDDLEWARE
=
[
...
...
@@ -124,7 +125,8 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/
STATIC_URL
=
'static/'
STATIC_URL
=
'/static/'
STATICFILES_DIRS
=
[
os
.
path
.
join
(
BASE_DIR
,
'static'
)]
# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
...
...
widget_father_when_can_i_be_on_my_own_i_have_the_hello_world_to_see/static/base_style.css
0 → 100644
View file @
113e781b
nav
:focus
{
outline
:
0
!important
;
}
ul
{
list-style-type
:
none
;
margin
:
0
;
padding
:
0
;
display
:
flex
;
flex-direction
:
row
;
width
:
100%
;
background-color
:
#bb00ff
;
}
ul
li
{
padding
:
20px
;
}
ul
li
a
{
padding
:
21px
;
text-decoration
:
none
;
color
:
white
;
}
ul
li
a
:hover
{
background-color
:
#cc00ff
}
body
{
margin
:
0
;
}
widget_father_when_can_i_be_on_my_own_i_have_the_hello_world_to_see/templates/base.html
0 → 100644
View file @
113e781b
<!-- project/template/base.html -->
{% load static %}
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
{% block title %}{% endblock %}
</title>
<link
href=
"{% static 'base_style.css' %}"
rel=
"stylesheet"
>
{% block styles %}{% endblock %}
</head>
<body>
<nav>
<ul>
<li><a
href=
"/homepage"
>
Homepage
</a></li>
<li><a
href=
"/assignments"
>
Assignments
</a></li>
<li><a
href=
"/forum"
>
Forum
</a></li>
<li><a
href=
"/announcements"
>
Announcement Board
</a></li>
</ul>
</nav>
<div
id=
"content"
>
{% block content %}{% endblock %}
</div>
{% block scripts %}{% endblock %}
</body>
</html>
\ 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