Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_tee jays angelos
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
Ramon Angelo Enriquez
widget_tee jays angelos
Commits
389bc251
Commit
389bc251
authored
Mar 25, 2022
by
Ramon Angelo Enriquez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added the new homepage DB attributes (id no., email) as well as the department DB
parent
a8622d58
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
67 additions
and
3 deletions
+67
-3
admin.cpython-39.pyc
...ee_jays_angelos/homepage/__pycache__/admin.cpython-39.pyc
+0
-0
models.cpython-39.pyc
...e_jays_angelos/homepage/__pycache__/models.cpython-39.pyc
+0
-0
views.cpython-39.pyc
...ee_jays_angelos/homepage/__pycache__/views.cpython-39.pyc
+0
-0
admin.py
widget_tee_jays_angelos/homepage/admin.py
+19
-2
0002_widgetuser_email_widgetuser_id_num_department.py
...ons/0002_widgetuser_email_widgetuser_id_num_department.py
+33
-0
models.py
widget_tee_jays_angelos/homepage/models.py
+12
-0
views.py
widget_tee_jays_angelos/homepage/views.py
+3
-1
No files found.
widget_tee_jays_angelos/homepage/__pycache__/admin.cpython-39.pyc
View file @
389bc251
No preview for this file type
widget_tee_jays_angelos/homepage/__pycache__/models.cpython-39.pyc
View file @
389bc251
No preview for this file type
widget_tee_jays_angelos/homepage/__pycache__/views.cpython-39.pyc
View file @
389bc251
No preview for this file type
widget_tee_jays_angelos/homepage/admin.py
View file @
389bc251
from
django.contrib
import
admin
from
.models
import
WidgetUser
from
.models
import
WidgetUser
,
Department
# Register your models here.
admin
.
site
.
register
(
WidgetUser
)
class
DepartmentAdminInline
(
admin
.
TabularInline
):
model
=
Department
class
WidgetUserAdmin
(
admin
.
ModelAdmin
):
model
=
WidgetUser
inlines
=
[
DepartmentAdminInline
]
class
DepartmentAdmin
(
admin
.
ModelAdmin
):
model
=
Department
admin
.
site
.
register
(
WidgetUser
,
WidgetUserAdmin
)
admin
.
site
.
register
(
Department
,
DepartmentAdmin
)
widget_tee_jays_angelos/homepage/migrations/0002_widgetuser_email_widgetuser_id_num_department.py
0 → 100644
View file @
389bc251
# Generated by Django 4.0.3 on 2022-03-25 18:37
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'homepage'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'widgetuser'
,
name
=
'email'
,
field
=
models
.
CharField
(
max_length
=
50
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'widgetuser'
,
name
=
'id_num'
,
field
=
models
.
CharField
(
max_length
=
7
,
null
=
True
),
),
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
)),
(
'widget_user'
,
models
.
ForeignKey
(
blank
=
True
,
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'homepage.widgetuser'
)),
],
),
]
widget_tee_jays_angelos/homepage/models.py
View file @
389bc251
...
...
@@ -6,6 +6,18 @@ 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
)
id_num
=
models
.
CharField
(
max_length
=
7
,
null
=
True
)
email
=
models
.
CharField
(
max_length
=
50
,
null
=
True
)
def
__str__
(
self
):
return
self
.
first_name
+
" "
+
self
.
last_name
class
Department
(
models
.
Model
):
widget_user
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
,
blank
=
True
,
null
=
True
)
dept_name
=
models
.
CharField
(
max_length
=
50
)
home_unit
=
models
.
CharField
(
max_length
=
50
)
def
__str__
(
self
):
return
self
.
dept_name
+
", "
+
self
.
home_unit
widget_tee_jays_angelos/homepage/views.py
View file @
389bc251
from
django.http
import
HttpResponse
from
homepage.models
import
WidgetUser
,
Department
# Create your views here.
def
index
(
request
):
return
HttpResponse
(
"Welcome to Widget!"
)
return
HttpResponse
(
"WIDGET USERS:<br>"
)
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