Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_group 18
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
Rac Gerard Elizaga
widget_group 18
Commits
69bd08b5
Commit
69bd08b5
authored
May 22, 2022
by
Christopher Jorge Chan
Browse files
Options
Browse Files
Download
Plain Diff
fixing conflict errors
parents
baef2b64
0dda8563
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
60 additions
and
10 deletions
+60
-10
0010_merge_20220522_2343.py
...oup_18/assignments/migrations/0010_merge_20220522_2343.py
+14
-0
0007_auto_20220518_1124.cpython-38.pyc
...ations/__pycache__/0007_auto_20220518_1124.cpython-38.pyc
+0
-0
0010_merge_20220522_2343.cpython-38.pyc
...tions/__pycache__/0010_merge_20220522_2343.cpython-38.pyc
+0
-0
homepage_forms.cpython-38.pyc
...oup_18/homepage/__pycache__/homepage_forms.cpython-38.pyc
+0
-0
0005_widgetuser_pfp.cpython-38.pyc
...migrations/__pycache__/0005_widgetuser_pfp.cpython-38.pyc
+0
-0
models.py
widget_group_18/homepage/models.py
+4
-0
adduser.html
widget_group_18/homepage/templates/homepage/adduser.html
+1
-1
details.html
widget_group_18/homepage/templates/homepage/details.html
+5
-3
home.html
widget_group_18/homepage/templates/homepage/home.html
+4
-2
urls.py
widget_group_18/homepage/urls.py
+3
-1
views.py
widget_group_18/homepage/views.py
+29
-3
No files found.
widget_group_18/assignments/migrations/0010_merge_20220522_2343.py
0 → 100644
View file @
69bd08b5
# Generated by Django 4.0.3 on 2022-05-22 15:43
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'assignments'
,
'0007_auto_20220518_1124'
),
(
'assignments'
,
'0009_alter_course_course_code_alter_course_course_title'
),
]
operations
=
[
]
widget_group_18/assignments/migrations/__pycache__/0007_auto_20220518_1124.cpython-38.pyc
View file @
69bd08b5
No preview for this file type
widget_group_18/assignments/migrations/__pycache__/0010_merge_20220522_2343.cpython-38.pyc
0 → 100644
View file @
69bd08b5
File added
widget_group_18/homepage/__pycache__/homepage_forms.cpython-38.pyc
View file @
69bd08b5
No preview for this file type
widget_group_18/homepage/migrations/__pycache__/0005_widgetuser_pfp.cpython-38.pyc
View file @
69bd08b5
No preview for this file type
widget_group_18/homepage/models.py
View file @
69bd08b5
...
...
@@ -5,6 +5,9 @@ class Department(models.Model):
dept_name
=
models
.
CharField
(
max_length
=
50
)
home_unit
=
models
.
CharField
(
max_length
=
50
)
def
__str__
(
self
):
return
self
.
dept_name
class
WidgetUser
(
models
.
Model
):
first_name
=
models
.
CharField
(
max_length
=
50
,
default
=
"A"
)
middle_name
=
models
.
CharField
(
max_length
=
50
,
default
=
"B"
)
...
...
@@ -12,6 +15,7 @@ class WidgetUser(models.Model):
id_num
=
models
.
CharField
(
max_length
=
7
,
default
=
""
)
email
=
models
.
CharField
(
max_length
=
100
,
default
=
""
)
department
=
models
.
ForeignKey
(
Department
,
on_delete
=
models
.
CASCADE
,
null
=
True
)
pfp
=
models
.
ImageField
(
upload_to
=
"userpfp/"
,
default
=
"userpfp/default.png"
)
def
__str__
(
self
):
return
self
.
first_name
widget_group_18/homepage/templates/homepage/adduser.html
View file @
69bd08b5
...
...
@@ -15,4 +15,4 @@
<a
href=
"{%url 'homepage'%}"
>
Return to Homepage
</a>
</div>
{%endblock%}
\ No newline at end of file
{%endblock%}
widget_group_18/homepage/templates/homepage/details.html
View file @
69bd08b5
...
...
@@ -6,11 +6,13 @@
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{%static 'homepage/css/details.css'%}"
>
<div
class=
"container main"
>
<img
id=
"profilepic"
src=
"{
%static imgurl%
}"
>
<br><br>
<img
id=
"profilepic"
src=
"{
{imgurl}
}"
>
<br><br>
<h1>
{{widget_user.last_name}}, {{widget_user.first_name}} {{widget_user.middle_name}}
</h1>
<h2>
{{widget_user.id_num}}
</h2>
<h3>
{{widget_user.email}}
</h3>
<h4>
{{widget_user.department.dept_name}}
</h4>
<h4>
{{widget_user.department.home_unit}}
</h4>
<h4>
{{widget_user.department.home_unit}}
</h4>
<br>
<a
href=
"{%url 'homepage'%}"
>
Return to Homepage
</a>
</div>
{%endblock%}
\ No newline at end of file
{%endblock%}
widget_group_18/homepage/templates/homepage/home.html
View file @
69bd08b5
...
...
@@ -12,6 +12,8 @@
{%for w in widget_users%}
<li><a
href=
"{%url 'details' w.id_num%}"
>
{{w.last_name}}, {{w.first_name}} {{w.middle_name}}
</a></li>
{%endfor%}
</ol>
</ol>
<br>
<h2><a
href=
"{%url 'adduser'%}"
>
Add User
</a></h2>
</div>
{%endblock%}
\ No newline at end of file
{%endblock%}
widget_group_18/homepage/urls.py
View file @
69bd08b5
from
django.urls
import
path
from
.
import
views
from
.views
import
UserDetailsView
urlpatterns
=
[
path
(
''
,
views
.
homepage_view
,
name
=
'homepage'
),
path
(
'users/<user_id>/details'
,
views
.
details
,
name
=
'details'
)
path
(
'users/<user_id>/details'
,
UserDetailsView
.
as_view
(),
name
=
'details'
),
path
(
'users/add'
,
views
.
addUser
,
name
=
'adduser'
)
]
\ No newline at end of file
widget_group_18/homepage/views.py
View file @
69bd08b5
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.views
import
View
from
.models
import
Department
,
WidgetUser
from
.homepage_forms
import
AddUserForm
# Create your views here.
"""
...
...
@@ -24,12 +26,36 @@ def homepage_view(request):
}
return
render
(
request
,
"homepage/home.html"
,
homepage_dict
)
#CBV
"""
def details(request, user_id):
widget_user = WidgetUser.objects.get(id_num=user_id)
imgurl
=
f
"
homepage/images
/{user_id}.png"
imgurl = f"
../../../media/userpfp
/{user_id}.png"
details_dict = {
"widget_user" : widget_user,
"imgurl" : imgurl
}
return
render
(
request
,
"homepage/details.html"
,
details_dict
)
\ No newline at end of file
return render(request, "homepage/details.html", details_dict)
"""
class
UserDetailsView
(
View
):
def
get
(
self
,
request
,
user_id
):
widget_user
=
WidgetUser
.
objects
.
get
(
id_num
=
user_id
)
imgurl
=
f
"../../../media/userpfp/{user_id}.png"
details_dict
=
{
"widget_user"
:
widget_user
,
"imgurl"
:
imgurl
}
return
render
(
request
,
"homepage/details.html"
,
details_dict
)
#FBV
def
addUser
(
request
):
form
=
AddUserForm
()
if
request
.
method
==
'POST'
:
form
=
AddUserForm
(
request
.
POST
,
request
.
FILES
)
if
form
.
is_valid
():
form
.
save
()
context
=
{
"form"
:
form
}
return
render
(
request
,
"homepage/adduser.html"
,
context
)
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