Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_bigdjangoenergy
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
Alec Dayupay
midterm_bigdjangoenergy
Commits
97cb6b8b
Commit
97cb6b8b
authored
Mar 02, 2023
by
Jose Enrique D. Siongco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding the dashboard app
parent
ba2e2cf6
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
98 additions
and
4 deletions
+98
-4
__init__.cpython-311.pyc
...angoenergy/dashboard/__pycache__/__init__.cpython-311.pyc
+0
-0
admin.cpython-311.pyc
...gdjangoenergy/dashboard/__pycache__/admin.cpython-311.pyc
+0
-0
apps.cpython-311.pyc
...igdjangoenergy/dashboard/__pycache__/apps.cpython-311.pyc
+0
-0
models.cpython-311.pyc
...djangoenergy/dashboard/__pycache__/models.cpython-311.pyc
+0
-0
urls.cpython-311.pyc
...igdjangoenergy/dashboard/__pycache__/urls.cpython-311.pyc
+0
-0
views.cpython-311.pyc
...gdjangoenergy/dashboard/__pycache__/views.cpython-311.pyc
+0
-0
admin.py
widget_bigdjangoenergy/dashboard/admin.py
+16
-1
apps.py
widget_bigdjangoenergy/dashboard/apps.py
+1
-1
0001_initial.py
widget_bigdjangoenergy/dashboard/migrations/0001_initial.py
+33
-0
0001_initial.cpython-311.pyc
...board/migrations/__pycache__/0001_initial.cpython-311.pyc
+0
-0
__init__.cpython-311.pyc
...dashboard/migrations/__pycache__/__init__.cpython-311.pyc
+0
-0
models.py
widget_bigdjangoenergy/dashboard/models.py
+24
-1
urls.py
widget_bigdjangoenergy/dashboard/urls.py
+9
-0
views.py
widget_bigdjangoenergy/dashboard/views.py
+15
-1
No files found.
widget_bigdjangoenergy/dashboard/__pycache__/__init__.cpython-311.pyc
0 → 100644
View file @
97cb6b8b
File added
widget_bigdjangoenergy/dashboard/__pycache__/admin.cpython-311.pyc
0 → 100644
View file @
97cb6b8b
File added
widget_bigdjangoenergy/dashboard/__pycache__/apps.cpython-311.pyc
0 → 100644
View file @
97cb6b8b
File added
widget_bigdjangoenergy/dashboard/__pycache__/models.cpython-311.pyc
0 → 100644
View file @
97cb6b8b
File added
widget_bigdjangoenergy/dashboard/__pycache__/urls.cpython-311.pyc
0 → 100644
View file @
97cb6b8b
File added
widget_bigdjangoenergy/dashboard/__pycache__/views.cpython-311.pyc
0 → 100644
View file @
97cb6b8b
File added
widget_bigdjangoenergy/dashboard/admin.py
View file @
97cb6b8b
from
django.contrib
import
admin
# Register your models here.
from
.models
import
department
,
widgetUser
class
departmentAdmin
(
admin
.
ModelAdmin
):
model
=
department
search_fields
=
(
'dept_name'
,
'home_unit'
)
list_display
=
(
'dept_name'
,
'home_unit'
)
list_filter
=
(
'dept_name'
,
'home_unit'
)
class
widgetUsersAdmin
(
admin
.
ModelAdmin
):
model
=
widgetUser
search_fields
=
(
'first_name'
,
'middle_name'
,
'last_name'
,
'department'
)
list_display
=
(
'first_name'
,
'last_name'
,
'department'
)
list_filter
=
(
'first_name'
,
'last_name'
,
'department'
)
admin
.
site
.
register
(
department
,
departmentAdmin
)
admin
.
site
.
register
(
widgetUser
,
widgetUsersAdmin
)
\ No newline at end of file
widget_bigdjangoenergy/dashboard/apps.py
View file @
97cb6b8b
...
...
@@ -3,4 +3,4 @@ from django.apps import AppConfig
class
DashboardConfig
(
AppConfig
):
default_auto_field
=
'django.db.models.BigAutoField'
name
=
'dashboard'
name
=
'dashboard'
\ No newline at end of file
widget_bigdjangoenergy/dashboard/migrations/0001_initial.py
0 → 100644
View file @
97cb6b8b
# Generated by Django 3.2 on 2023-03-02 07:28
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
initial
=
True
dependencies
=
[
]
operations
=
[
migrations
.
CreateModel
(
name
=
'department'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'dept_name'
,
models
.
CharField
(
max_length
=
100
)),
(
'home_unit'
,
models
.
CharField
(
max_length
=
100
)),
],
),
migrations
.
CreateModel
(
name
=
'widgetUser'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'first_name'
,
models
.
CharField
(
max_length
=
100
)),
(
'middle_name'
,
models
.
CharField
(
max_length
=
100
)),
(
'last_name'
,
models
.
CharField
(
max_length
=
100
)),
(
'department'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'dashboard.department'
)),
],
),
]
widget_bigdjangoenergy/dashboard/migrations/__pycache__/0001_initial.cpython-311.pyc
0 → 100644
View file @
97cb6b8b
File added
widget_bigdjangoenergy/dashboard/migrations/__pycache__/__init__.cpython-311.pyc
0 → 100644
View file @
97cb6b8b
File added
widget_bigdjangoenergy/dashboard/models.py
View file @
97cb6b8b
from
django.db
import
models
from
django.urls
import
reverse
# Create your models here.
class
department
(
models
.
Model
):
dept_name
=
models
.
CharField
(
max_length
=
100
)
home_unit
=
models
.
CharField
(
max_length
=
100
,
)
def
__str__
(
self
):
return
'{}'
.
format
(
self
.
dept_name
)
def
get_absolute_url
(
self
):
return
reverse
(
'department'
,
args
=
[
str
(
self
.
dept_name
)])
class
widgetUser
(
models
.
Model
):
first_name
=
models
.
CharField
(
max_length
=
100
)
middle_name
=
models
.
CharField
(
max_length
=
100
)
last_name
=
models
.
CharField
(
max_length
=
100
)
department
=
models
.
ForeignKey
(
department
,
on_delete
=
models
.
CASCADE
,)
def
__str__
(
self
):
return
'{} {}'
.
format
(
self
.
first_name
,
self
.
last_name
)
def
get_absolute_url
(
self
):
return
reverse
(
'widgetUser'
,
args
=
[
str
(
self
.
last_name
)])
\ No newline at end of file
widget_bigdjangoenergy/dashboard/urls.py
0 → 100644
View file @
97cb6b8b
from
django.urls
import
path
from
.views
import
dashboard
urlpatterns
=
[
path
(
''
,
dashboard
,
name
=
"dashboard"
)
]
app_name
=
"dashboard"
\ No newline at end of file
widget_bigdjangoenergy/dashboard/views.py
View file @
97cb6b8b
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
.models
import
department
,
widgetUser
# Create your views here.
def
dashboard
(
request
):
welcome_message
=
"Welcome to Widget!<br><br>WIDGET USERS:<br>"
all_widgetUser
=
widgetUser
.
objects
.
all
()
for
member
in
all_widgetUser
:
last_name
=
member
.
last_name
first_name
=
member
.
first_name
middle_name
=
member
.
middle_name
dept_name
=
member
.
department
.
dept_name
home_unit
=
member
.
department
.
home_unit
output
=
"{lastName}, {firstName} {middleName}: {deptName}, {homeUnit}<br>"
.
format
(
lastName
=
last_name
,
firstName
=
first_name
,
middleName
=
middle_name
,
deptName
=
dept_name
,
homeUnit
=
home_unit
)
welcome_message
+=
output
return
HttpResponse
(
welcome_message
)
\ 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