Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_group3
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
Jonathan Talbot
widget_group3
Commits
88d787c1
Commit
88d787c1
authored
Apr 07, 2022
by
Jonathan Talbot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stuff
parent
d7c88b7b
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
93 additions
and
4 deletions
+93
-4
db.sqlite3
widget_group3/db.sqlite3
+0
-0
admin.cpython-310.pyc
...et_group3/widget_group3/__pycache__/admin.cpython-310.pyc
+0
-0
models.cpython-310.pyc
...t_group3/widget_group3/__pycache__/models.cpython-310.pyc
+0
-0
views.cpython-310.pyc
...et_group3/widget_group3/__pycache__/views.cpython-310.pyc
+0
-0
admin.py
widget_group3/widget_group3/admin.py
+12
-2
0001_initial.py
widget_group3/widget_group3/migrations/0001_initial.py
+62
-0
__init__.py
widget_group3/widget_group3/migrations/__init__.py
+0
-0
0001_initial.cpython-310.pyc
...roup3/migrations/__pycache__/0001_initial.cpython-310.pyc
+0
-0
__init__.cpython-310.pyc
...et_group3/migrations/__pycache__/__init__.cpython-310.pyc
+0
-0
models.py
widget_group3/widget_group3/models.py
+15
-1
views.py
widget_group3/widget_group3/views.py
+4
-1
No files found.
widget_group3/db.sqlite3
View file @
88d787c1
No preview for this file type
widget_group3/widget_group3/__pycache__/admin.cpython-310.pyc
View file @
88d787c1
No preview for this file type
widget_group3/widget_group3/__pycache__/models.cpython-310.pyc
View file @
88d787c1
No preview for this file type
widget_group3/widget_group3/__pycache__/views.cpython-310.pyc
View file @
88d787c1
No preview for this file type
widget_group3/widget_group3/admin.py
View file @
88d787c1
from
django.contrib
import
admin
from
django.contrib
import
admin
from
.models
import
WidgetUser
,
Forum
,
Announcement
,
Assignment
from
.models
import
WidgetUser
,
Forum
,
Announcement
,
Assignment
,
Department
# Classes
# Classes
class
DepartmentInline
(
admin
.
TabularInline
):
model
=
Department
class
WidgetUserAdmin
(
admin
.
ModelAdmin
):
class
WidgetUserAdmin
(
admin
.
ModelAdmin
):
model
=
WidgetUser
model
=
WidgetUser
...
@@ -14,13 +17,20 @@ class WidgetUserAdmin(admin.ModelAdmin):
...
@@ -14,13 +17,20 @@ class WidgetUserAdmin(admin.ModelAdmin):
fieldsets
=
[
fieldsets
=
[
(
'Widget User Data'
,
{
(
'Widget User Data'
,
{
'fields'
:
[
'fields'
:
[
'id_num'
,
'first_name'
,
'first_name'
,
'middle_name'
,
'middle_name'
,
'last_name'
'last_name'
,
'email'
]
]
}),
}),
]
]
inlines
=
[
DepartmentInline
,]
class
DepartmentAdmin
(
admin
.
ModelAdmin
):
model
=
Department
class
AnnouncementAdmin
(
admin
.
ModelAdmin
):
class
AnnouncementAdmin
(
admin
.
ModelAdmin
):
model
=
Announcement
model
=
Announcement
...
...
widget_group3/widget_group3/migrations/0001_initial.py
0 → 100644
View file @
88d787c1
# Generated by Django 4.0.3 on 2022-04-07 06:21
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
initial
=
True
dependencies
=
[
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Announcement'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'announcement_title'
,
models
.
CharField
(
max_length
=
50
)),
(
'announcement_body'
,
models
.
CharField
(
max_length
=
200
)),
(
'pub_date'
,
models
.
DateTimeField
(
auto_now_add
=
True
)),
],
),
migrations
.
CreateModel
(
name
=
'Assignment'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'name'
,
models
.
CharField
(
max_length
=
100
)),
(
'description'
,
models
.
CharField
(
max_length
=
200
)),
(
'max_points'
,
models
.
IntegerField
()),
],
),
migrations
.
CreateModel
(
name
=
'Forum'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'post_title'
,
models
.
CharField
(
max_length
=
50
)),
(
'post_body'
,
models
.
CharField
(
max_length
=
100
)),
(
'pub_date'
,
models
.
DateTimeField
(
auto_now_add
=
True
)),
],
),
migrations
.
CreateModel
(
name
=
'WidgetUser'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'id_num'
,
models
.
IntegerField
()),
(
'first_name'
,
models
.
CharField
(
max_length
=
100
)),
(
'middle_name'
,
models
.
CharField
(
max_length
=
100
)),
(
'last_name'
,
models
.
CharField
(
max_length
=
100
)),
(
'email'
,
models
.
EmailField
(
max_length
=
254
)),
],
),
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
)),
(
'widget_user'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'widget_group3.widgetuser'
)),
],
),
]
widget_group3/widget_group3/migrations/__init__.py
0 → 100644
View file @
88d787c1
widget_group3/widget_group3/migrations/__pycache__/0001_initial.cpython-310.pyc
0 → 100644
View file @
88d787c1
File added
widget_group3/widget_group3/migrations/__pycache__/__init__.cpython-310.pyc
0 → 100644
View file @
88d787c1
File added
widget_group3/widget_group3/models.py
View file @
88d787c1
from
django.db
import
models
from
django.db
import
models
from
django.urls
import
reverse
from
django.urls
import
reverse
class
WidgetUser
(
models
.
Model
):
class
WidgetUser
(
models
.
Model
):
id_num
=
models
.
IntegerField
()
first_name
=
models
.
CharField
(
max_length
=
100
)
first_name
=
models
.
CharField
(
max_length
=
100
)
middle_name
=
models
.
CharField
(
max_length
=
100
)
middle_name
=
models
.
CharField
(
max_length
=
100
)
last_name
=
models
.
CharField
(
max_length
=
100
)
last_name
=
models
.
CharField
(
max_length
=
100
)
email
=
models
.
EmailField
()
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
full_name
return
'{}, {} {}: {}, {}'
.
format
(
self
.
last_name
,
self
.
first_name
,
self
.
middle_name
,
self
.
id_num
,
self
.
email
)
def
get_absolute_url
(
self
):
def
get_absolute_url
(
self
):
return
reverse
(
'widget_user'
,
args
=
[(
self
.
full_name
)])
return
reverse
(
'widget_user'
,
args
=
[(
self
.
full_name
)])
...
@@ -16,6 +19,17 @@ class WidgetUser(models.Model):
...
@@ -16,6 +19,17 @@ class WidgetUser(models.Model):
def
full_name
(
self
):
def
full_name
(
self
):
return
'{} {} {}'
.
format
(
self
.
first_name
,
self
.
middle_name
,
self
.
last_name
)
return
'{} {} {}'
.
format
(
self
.
first_name
,
self
.
middle_name
,
self
.
last_name
)
# Department used for widget user
class
Department
(
models
.
Model
):
dept_name
=
models
.
CharField
(
max_length
=
100
)
home_unit
=
models
.
CharField
(
max_length
=
100
)
widget_user
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
)
def
__str__
(
self
):
return
'{}, {}'
.
format
(
self
.
dept_name
,
self
.
home_unit
)
class
Announcement
(
models
.
Model
):
class
Announcement
(
models
.
Model
):
announcement_title
=
models
.
CharField
(
max_length
=
50
)
announcement_title
=
models
.
CharField
(
max_length
=
50
)
announcement_body
=
models
.
CharField
(
max_length
=
200
)
announcement_body
=
models
.
CharField
(
max_length
=
200
)
...
...
widget_group3/widget_group3/views.py
View file @
88d787c1
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
.models
import
WidgetUser
,
Forum
,
Announcement
,
Assignment
,
Department
def
homepage
(
request
):
def
homepage
(
request
):
return
HttpResponse
(
'Welcome to Widget!'
)
widget_users
=
WidgetUser
.
objects
.
all
()
output
=
"WIDGET USERS:
\n
"
+
"
\n
"
.
join
([
str
(
user
)
for
user
in
widget_users
])
return
HttpResponse
(
output
,
content_type
=
"text/plain"
)
def
assignments
(
request
):
def
assignments
(
request
):
return
HttpResponse
(
'This is the Assignments page!'
)
return
HttpResponse
(
'This is the Assignments page!'
)
...
...
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