Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_group 23
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
Bianca Aguilar
widget_group 23
Commits
72d001e7
Commit
72d001e7
authored
Apr 04, 2022
by
Bianca Aguilar
Browse files
Options
Browse Files
Download
Plain Diff
Updating branch since homepage's models were updated
parents
af97df63
3a9d9ca2
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
202 additions
and
8 deletions
+202
-8
README.md
README.md
+4
-0
admin.py
assignments/admin.py
+6
-2
0002_course.py
assignments/migrations/0002_course.py
+22
-0
0003_assignment_course.py
assignments/migrations/0003_assignment_course.py
+20
-0
0002_course.cpython-310.pyc
...nments/migrations/__pycache__/0002_course.cpython-310.pyc
+0
-0
0003_assignment_course.cpython-310.pyc
...ations/__pycache__/0003_assignment_course.cpython-310.pyc
+0
-0
models.py
assignments/models.py
+26
-1
views.py
assignments/views.py
+22
-1
admin.py
homepage/admin.py
+6
-2
0002_department_widgetuser_email_widgetuser_id_num.py
...ons/0002_department_widgetuser_email_widgetuser_id_num.py
+33
-0
0003_widgetuser_department.py
homepage/migrations/0003_widgetuser_department.py
+20
-0
0002_department_widgetuser_email_widgetuser_id_num.cpython-310.pyc
...rtment_widgetuser_email_widgetuser_id_num.cpython-310.pyc
+0
-0
0003_widgetuser_department.cpython-310.pyc
...ns/__pycache__/0003_widgetuser_department.cpython-310.pyc
+0
-0
models.py
homepage/models.py
+22
-1
views.py
homepage/views.py
+21
-1
No files found.
README.md
View file @
72d001e7
...
...
@@ -9,6 +9,10 @@
+
Assignments (Lab 1)
+
Assignments Models (Lab 2)
+
Homepage Models (Lab 2)
+
Assignments Models (Midterm)
+
Assignments View (Midterm)
+
Homepage Models (Midterm)
+
Homepage View (Midterm)
**Nicolas Reichert:**
+
Announcements Models (Lab 2)
...
...
assignments/admin.py
View file @
72d001e7
from
django.contrib
import
admin
from
.models
import
Assignment
from
.models
import
Assignment
,
Course
# Register your models here.
class
AssignmentAdmin
(
admin
.
ModelAdmin
):
model
=
Assignment
admin
.
site
.
register
(
Assignment
,
AssignmentAdmin
)
\ No newline at end of file
class
CourseAdmin
(
admin
.
ModelAdmin
):
model
=
Course
admin
.
site
.
register
(
Assignment
,
AssignmentAdmin
)
admin
.
site
.
register
(
Course
,
CourseAdmin
)
\ No newline at end of file
assignments/migrations/0002_course.py
0 → 100644
View file @
72d001e7
# Generated by Django 4.0.3 on 2022-04-04 09:04
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'assignments'
,
'0001_initial'
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Course'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'course_code'
,
models
.
CharField
(
max_length
=
10
)),
(
'course_title'
,
models
.
CharField
(
max_length
=
50
)),
(
'section'
,
models
.
CharField
(
max_length
=
3
)),
],
),
]
assignments/migrations/0003_assignment_course.py
0 → 100644
View file @
72d001e7
# Generated by Django 4.0.3 on 2022-04-04 09:08
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'assignments'
,
'0002_course'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'assignment'
,
name
=
'course'
,
field
=
models
.
ForeignKey
(
default
=
1
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'assignments.course'
),
preserve_default
=
False
,
),
]
assignments/migrations/__pycache__/0002_course.cpython-310.pyc
0 → 100644
View file @
72d001e7
File added
assignments/migrations/__pycache__/0003_assignment_course.cpython-310.pyc
0 → 100644
View file @
72d001e7
File added
assignments/models.py
View file @
72d001e7
from
django.db
import
models
# Create your models here.
class
Course
(
models
.
Model
):
course_code
=
models
.
CharField
(
max_length
=
10
)
course_title
=
models
.
CharField
(
max_length
=
50
)
section
=
models
.
CharField
(
max_length
=
3
)
@
property
def
course_info
(
self
):
return
'{} {} {}'
.
format
(
self
.
course_code
,
self
.
course_title
,
self
.
section
)
class
Assignment
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
50
)
description
=
models
.
CharField
(
max_length
=
500
)
max_points
=
models
.
IntegerField
()
\ No newline at end of file
max_points
=
models
.
IntegerField
()
course
=
models
.
ForeignKey
(
Course
,
on_delete
=
models
.
CASCADE
)
@
property
def
passing_score
(
self
):
return
self
.
max_points
*
0.60
@
property
def
assignment_info
(
self
):
assignment
=
'<br>Assignment Name: {}'
.
format
(
self
.
name
)
assignment
+=
'<br>Description: {}'
.
format
(
self
.
description
)
assignment
+=
'<br>Perfect Score: {}'
.
format
(
self
.
max_points
)
assignment
+=
'<br>Passing Score: {}'
.
format
(
self
.
passing_score
)
assignment
+=
'<br>Course/Section: {}<br>'
.
format
(
self
.
course
.
course_info
)
return
assignment
\ No newline at end of file
assignments/views.py
View file @
72d001e7
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
.models
import
Assignment
# Create your views here.
def
index
(
request
):
return
HttpResponse
(
"This is the Assignments page!"
)
\ No newline at end of file
def
assignment_list
():
final_list
=
''
for
a
in
range
(
len
(
Assignment
.
objects
.
all
())):
final_list
+=
'{}'
.
format
(
Assignment
.
objects
.
get
(
pk
=
a
+
1
)
.
assignment_info
)
return
final_list
html
=
f
'''
<html>
<body>
<header><h1>ASSIGNMENTS:</h1><header>
<main>
<p>{assignment_list()}</p>
</main>
</body>
</html>
'''
return
HttpResponse
(
html
)
\ No newline at end of file
homepage/admin.py
View file @
72d001e7
from
django.contrib
import
admin
from
.models
import
WidgetUser
from
.models
import
WidgetUser
,
Department
# Register your models here.
class
WidgetUserAdmin
(
admin
.
ModelAdmin
):
model
=
WidgetUser
admin
.
site
.
register
(
WidgetUser
,
WidgetUserAdmin
)
\ No newline at end of file
class
DepartmentAdmin
(
admin
.
ModelAdmin
):
model
=
Department
admin
.
site
.
register
(
WidgetUser
,
WidgetUserAdmin
)
admin
.
site
.
register
(
Department
,
DepartmentAdmin
)
\ No newline at end of file
homepage/migrations/0002_department_widgetuser_email_widgetuser_id_num.py
0 → 100644
View file @
72d001e7
# Generated by Django 4.0.3 on 2022-04-04 12:43
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'homepage'
,
'0001_initial'
),
]
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
=
50
)),
(
'home_unit'
,
models
.
CharField
(
max_length
=
50
)),
],
),
migrations
.
AddField
(
model_name
=
'widgetuser'
,
name
=
'email'
,
field
=
models
.
EmailField
(
default
=
1
,
max_length
=
254
),
preserve_default
=
False
,
),
migrations
.
AddField
(
model_name
=
'widgetuser'
,
name
=
'id_num'
,
field
=
models
.
CharField
(
default
=
1
,
max_length
=
7
),
preserve_default
=
False
,
),
]
homepage/migrations/0003_widgetuser_department.py
0 → 100644
View file @
72d001e7
# Generated by Django 4.0.3 on 2022-04-04 12:47
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'homepage'
,
'0002_department_widgetuser_email_widgetuser_id_num'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'widgetuser'
,
name
=
'department'
,
field
=
models
.
ForeignKey
(
default
=
1
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'homepage.department'
),
preserve_default
=
False
,
),
]
homepage/migrations/__pycache__/0002_department_widgetuser_email_widgetuser_id_num.cpython-310.pyc
0 → 100644
View file @
72d001e7
File added
homepage/migrations/__pycache__/0003_widgetuser_department.cpython-310.pyc
0 → 100644
View file @
72d001e7
File added
homepage/models.py
View file @
72d001e7
from
django.db
import
models
# Create your models here.
class
Department
(
models
.
Model
):
dept_name
=
models
.
CharField
(
max_length
=
50
)
home_unit
=
models
.
CharField
(
max_length
=
50
)
@
property
def
dept_info
(
self
):
return
'{}, {}'
.
format
(
self
.
dept_name
,
self
.
home_unit
)
class
WidgetUser
(
models
.
Model
):
first_name
=
models
.
CharField
(
max_length
=
50
)
middle_name
=
models
.
CharField
(
max_length
=
50
)
last_name
=
models
.
CharField
(
max_length
=
50
)
\ No newline at end of file
last_name
=
models
.
CharField
(
max_length
=
50
)
id_num
=
models
.
CharField
(
max_length
=
7
)
email
=
models
.
EmailField
()
department
=
models
.
ForeignKey
(
Department
,
on_delete
=
models
.
CASCADE
)
@
property
def
full_name
(
self
):
return
'{}, {} {}'
.
format
(
self
.
last_name
,
self
.
first_name
,
self
.
middle_name
)
@
property
def
user_info
(
self
):
return
'<br>{}: {}, {}, {}'
.
format
(
self
.
full_name
,
self
.
id_num
,
self
.
email
,
self
.
department
.
dept_info
)
\ No newline at end of file
homepage/views.py
View file @
72d001e7
from
django.http
import
HttpResponse
from
.models
import
WidgetUser
def
index
(
request
):
return
HttpResponse
(
'Welcome to Widget!'
)
def
user_list
():
final_list
=
''
for
u
in
range
(
len
(
WidgetUser
.
objects
.
all
())):
final_list
+=
'{}'
.
format
(
WidgetUser
.
objects
.
get
(
pk
=
u
+
1
)
.
user_info
)
return
final_list
html
=
f
'''
<html>
<body>
<header><h1>WIDGET USERS:</h1><header>
<main>
<p>{user_list()}</p>
</main>
</body>
</html>
'''
return
HttpResponse
(
html
)
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