Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_huli
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
Izaac Daniel B. Muncal
midterm_huli
Commits
0d27a7db
Commit
0d27a7db
authored
Mar 06, 2023
by
Brescia Amandy
Browse files
Options
Browse Files
Download
Plain Diff
Pulled changes from main
parents
802e8714
18b6b350
Changes
21
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
204 additions
and
0 deletions
+204
-0
__init__.py
widget_huli/Announcement_Board/__init__.py
+0
-0
admin.py
widget_huli/Announcement_Board/admin.py
+16
-0
apps.py
widget_huli/Announcement_Board/apps.py
+6
-0
__init__.py
widget_huli/Announcement_Board/migrations/__init__.py
+0
-0
models.py
widget_huli/Announcement_Board/models.py
+23
-0
tests.py
widget_huli/Announcement_Board/tests.py
+3
-0
urls.py
widget_huli/Announcement_Board/urls.py
+8
-0
views.py
widget_huli/Announcement_Board/views.py
+30
-0
__init__.py
widget_huli/dashboard/__init__.py
+0
-0
admin.py
widget_huli/dashboard/admin.py
+23
-0
apps.py
widget_huli/dashboard/apps.py
+6
-0
0001_initial.py
widget_huli/dashboard/migrations/0001_initial.py
+33
-0
__init__.py
widget_huli/dashboard/migrations/__init__.py
+0
-0
models.py
widget_huli/dashboard/models.py
+19
-0
tests.py
widget_huli/dashboard/tests.py
+3
-0
urls.py
widget_huli/dashboard/urls.py
+9
-0
views.py
widget_huli/dashboard/views.py
+17
-0
__init__.cpython-311.pyc
widget_huli/widget_huli/__pycache__/__init__.cpython-311.pyc
+0
-0
settings.cpython-311.pyc
widget_huli/widget_huli/__pycache__/settings.cpython-311.pyc
+0
-0
settings.py
widget_huli/widget_huli/settings.py
+4
-0
urls.py
widget_huli/widget_huli/urls.py
+4
-0
No files found.
widget_huli/Announcement_Board/__init__.py
0 → 100644
View file @
0d27a7db
widget_huli/Announcement_Board/admin.py
0 → 100644
View file @
0d27a7db
from
django.contrib
import
admin
from
.models
import
Reaction
,
Announcement
# Register your models here.
class
ReactionInLine
(
admin
.
TabularInline
):
model
=
Reaction
extra
=
1
class
AnnouncementAdmin
(
admin
.
ModelAdmin
):
inlines
=
[
ReactionInLine
,]
list_display
=
(
'title'
,
'author'
,
'pub_datetime'
,
'body'
)
search_fields
=
(
'title'
,
'author'
,
'body'
)
list_filter
=
(
'author'
,
'pub_datetime'
)
widget_huli/Announcement_Board/apps.py
0 → 100644
View file @
0d27a7db
from
django.apps
import
AppConfig
class
AnnouncementBoardConfig
(
AppConfig
):
default_auto_field
=
'django.db.models.BigAutoField'
name
=
'Announcement_Board'
widget_huli/Announcement_Board/migrations/__init__.py
0 → 100644
View file @
0d27a7db
widget_huli/Announcement_Board/models.py
0 → 100644
View file @
0d27a7db
from
django.db
import
models
from
django.urls
import
reverse
from
dashboard.model
import
WidgetUser
# Create your models here.
class
Announcement
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
50
)
body
=
models
.
TextField
()
author
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
)
pub_datetime
=
models
.
DateTimeField
()
class
Reaction
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
50
)
tally
=
models
.
IntegerField
()
announcement
=
models
.
ForeignKey
(
Announcement
,
on_delete
=
models
.
CASCADE
)
widget_huli/Announcement_Board/tests.py
0 → 100644
View file @
0d27a7db
from
django.test
import
TestCase
# Create your tests here.
widget_huli/Announcement_Board/urls.py
0 → 100644
View file @
0d27a7db
from
django.urls
import
path
from
.views
import
index
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
]
app_name
=
"Announcement_Board"
widget_huli/Announcement_Board/views.py
0 → 100644
View file @
0d27a7db
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
.models
import
Announcement
,
Reaction
# Create your views here.
def
index
(
request
):
return_string
=
'<body> <ul>'
reaction_string
=
''
for
announcement
in
Announcement
.
objects
.
all
():
announcement_string
=
'<li>{} by {} published <br>{}</li>'
.
format
(
announcement
.
title
,
announcement
.
author
,
announcement
.
pub_datetime
.
strftime
(
'
%
m/
%
d/
%
Y
%
H:
%
M
%
p'
),
announcement
.
body
)
for
reaction
in
Reaction
.
objects
.
all
():
if
reaction
.
announcement
==
announcement
:
reaction_string
+=
'<li>{}: {}</li>'
.
format
(
reaction
.
name
,
reaction
.
tally
)
return_string
+=
announcement_string
return_string
+=
reaction_string
return_string
+=
'<br>'
return_string
+=
'</ul></body>'
html_string
=
'<htmk>{}</html>'
.
format
(
return_string
)
return
HttpResponse
(
html_string
)
\ No newline at end of file
widget_huli/dashboard/__init__.py
0 → 100644
View file @
0d27a7db
widget_huli/dashboard/admin.py
0 → 100644
View file @
0d27a7db
from
django.contrib
import
admin
from
.models
import
Department
,
WidgetUser
class
DepartmentAdmin
(
admin
.
ModelAdmin
):
model
=
Department
list_display
=
(
'dept_name'
,
'home_unit'
)
search_fields
=
(
'dept_name'
,
'home_unit'
)
list_filter
=
(
'dept_name'
,)
class
WidgetUserAdmin
(
admin
.
ModelAdmin
):
model
=
WidgetUser
list_display
=
(
'last_name'
,
'first_name'
,
'middle_name'
,
'department'
)
search_fields
=
(
'last_name'
,
'first_name'
,
'middle_name'
)
list_filter
=
(
'last_name'
,
'first_name'
)
admin
.
site
.
register
(
Department
,
DepartmentAdmin
)
admin
.
site
.
register
(
WidgetUser
,
WidgetUserAdmin
)
widget_huli/dashboard/apps.py
0 → 100644
View file @
0d27a7db
from
django.apps
import
AppConfig
class
DashboardConfig
(
AppConfig
):
default_auto_field
=
'django.db.models.BigAutoField'
name
=
'dashboard'
widget_huli/dashboard/migrations/0001_initial.py
0 → 100644
View file @
0d27a7db
# Generated by Django 4.1.7 on 2023-03-04 06:14
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
=
60
)),
(
'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
=
20
)),
(
'middle_name'
,
models
.
CharField
(
max_length
=
20
)),
(
'last_name'
,
models
.
CharField
(
max_length
=
20
)),
(
'department'
,
models
.
ForeignKey
(
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'dashboard.department'
)),
],
),
]
widget_huli/dashboard/migrations/__init__.py
0 → 100644
View file @
0d27a7db
widget_huli/dashboard/models.py
0 → 100644
View file @
0d27a7db
from
django.db
import
models
class
Department
(
models
.
Model
):
dept_name
=
models
.
CharField
(
max_length
=
60
)
home_unit
=
models
.
CharField
(
max_length
=
100
)
def
__str__
(
self
):
return
'{}, {}'
.
format
(
self
.
dept_name
,
self
.
home_unit
)
class
WidgetUser
(
models
.
Model
):
first_name
=
models
.
CharField
(
max_length
=
20
)
middle_name
=
models
.
CharField
(
max_length
=
20
)
last_name
=
models
.
CharField
(
max_length
=
20
)
department
=
models
.
ForeignKey
(
Department
,
null
=
True
,
on_delete
=
models
.
CASCADE
)
def
__str__
(
self
):
return
'{}, {} {} : {}'
.
format
(
self
.
last_name
,
self
.
first_name
,
self
.
middle_name
,
self
.
department
)
\ No newline at end of file
widget_huli/dashboard/tests.py
0 → 100644
View file @
0d27a7db
from
django.test
import
TestCase
# Create your tests here.
widget_huli/dashboard/urls.py
0 → 100644
View file @
0d27a7db
from
django.urls
import
path
from
.views
import
index
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
]
dashboard
=
"Dashboard"
\ No newline at end of file
widget_huli/dashboard/views.py
0 → 100644
View file @
0d27a7db
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
.models
import
WidgetUser
,
Department
def
index
(
request
):
text_in_http
=
"Welcome to Widget! <br> <br> WIDGET USERS: <br> <ul>"
for
user
in
WidgetUser
.
objects
.
all
():
text_in_http
+=
"<li>{}, {} {} : {}</li>"
.
format
(
user
.
last_name
,
user
.
first_name
,
user
.
middle_name
,
user
.
department
)
text_in_http
+=
"</ul>"
html_string
=
'<html><body>{}</body></html>'
.
format
(
text_in_http
)
return
HttpResponse
(
html_string
)
widget_huli/widget_huli/__pycache__/__init__.cpython-311.pyc
0 → 100644
View file @
0d27a7db
File added
widget_huli/widget_huli/__pycache__/settings.cpython-311.pyc
0 → 100644
View file @
0d27a7db
File added
widget_huli/widget_huli/settings.py
View file @
0d27a7db
...
...
@@ -9,6 +9,8 @@ https://docs.djangoproject.com/en/4.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.1/ref/settings/
"""
import
os
from
dotenv
import
load_dotenv
import
os
from
pathlib
import
Path
...
...
@@ -35,6 +37,7 @@ ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS
=
[
'dashboard'
,
'django.contrib.admin'
,
'django.contrib.auth'
,
'django.contrib.contenttypes'
,
...
...
@@ -42,6 +45,7 @@ INSTALLED_APPS = [
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
'assignments'
,
'Announcement_Board'
,
]
MIDDLEWARE
=
[
...
...
widget_huli/widget_huli/urls.py
View file @
0d27a7db
...
...
@@ -16,8 +16,12 @@ Including another URLconf
from
django.contrib
import
admin
from
django.urls
import
include
,
path
from
django.urls
import
include
,
path
urlpatterns
=
[
path
(
'assignments/'
,
include
(
'assignments.urls'
,
namespace
=
"assignments"
)),
path
(
'Announcement_Board/'
,
include
(
'Announcement_Board.urls'
,
namespace
=
"Announcement_Board"
)),
path
(
'dashboard'
,
include
(
'dashboard.urls'
,
namespace
=
"dashboard"
)),
path
(
'admin/'
,
admin
.
site
.
urls
),
]
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