Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_vincentdjango
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
1
Merge Requests
1
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
Almira Redoble
midterm_vincentdjango
Commits
c6a6fc19
Commit
c6a6fc19
authored
Mar 06, 2023
by
Andrew Justin C. Idquival
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed admin properties and models string output
parent
1b927ea1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
20 deletions
+42
-20
admin.py
widget_vincentdjango/calendar/admin.py
+28
-6
models.py
widget_vincentdjango/calendar/models.py
+14
-14
No files found.
widget_vincentdjango/calendar/admin.py
View file @
c6a6fc19
...
...
@@ -6,16 +6,38 @@ class EventInline(admin.TabularInline):
model
=
Event
class
WidgetUser
Admin
(
admin
.
ModelAdmin
):
class
Event
Admin
(
admin
.
ModelAdmin
):
model
=
Event
list_display
=
(
'
last_name'
,
'first_name'
,
'department
'
)
search_fields
=
(
'
last_name'
,
'first_name'
,
'department
'
)
list_filter
=
(
'
last_name'
,
'department
'
)
list_display
=
(
'
target_datetime'
,
'activity'
,
'estimated_hours'
,
'location
'
)
search_fields
=
(
'
target_datetime'
,
'activity'
,
'estimated_hours'
,
'location
'
)
list_filter
=
(
'
target_datetime'
,
'location
'
)
fieldsets
=
[
(
'
Name
'
,
{
(
'
Event
'
,
{
'fields'
:
((
'
last_name'
,
'first_name'
),
'middle_name'
,
'department
'
,),
((
'
target_datetime'
,
'activity'
),
'estimated_hours'
,
'location
'
,),
}),
]
class
LocationAdmin
(
admin
.
ModelAdmin
):
model
=
Location
list_display
=
(
'mode'
,
'venue'
)
search_fields
=
(
'mode'
,
'venue'
)
list_filter
=
(
'mode'
,
'venue'
)
fieldsets
=
[
(
'Mode & Venue'
,
{
'fields'
:
(
'mode'
,
'venue'
)
})
]
inlines
=
[
EventInline
,
]
admin
.
site
.
register
(
Event
,
EventAdmin
)
admin
.
site
.
register
(
Location
,
LocationAdmin
)
\ No newline at end of file
widget_vincentdjango/calendar/models.py
View file @
c6a6fc19
...
...
@@ -2,24 +2,24 @@ from django.db import models
from
datetime
import
datetime
class
Location
(
models
.
Model
):
mode
=
models
.
CharField
(
max_length
=
100
,
default
=
""
)
venue
=
models
.
CharField
(
max_length
=
100
,
default
=
""
)
def
__str__
(
self
):
return
'{} {}'
.
format
(
self
.
mode
,
self
.
venue
)
class
Event
(
models
.
Model
):
target_datetime
=
models
.
DateTimeField
(
default
=
datetime
.
now
())
activity
=
models
.
CharField
(
max_length
=
100
,
default
=
""
)
estimated_hours
=
models
.
FloatField
(
default
=
0
)
location
=
models
.
CharField
(
max_length
=
100
,
default
=
""
)
course
=
models
.
CharField
(
max_length
=
100
,
default
=
""
)
location
=
models
.
ForeignKey
(
Location
,
on_delete
=
models
.
CASCADE
,
related_name
=
'Venue'
)
def
__str__
(
self
):
return
"Widget’s Calendar of Activities"
"Date and Time: {}"
'Activity: {}'
'Estimated Hours: {}'
'Course/Section: {}'
.
format
(
self
.
target_datetime
,
self
.
activity
,
self
.
estimated_hours
,
self
.
course
)
class
Location
(
models
.
Model
):
mode
=
models
.
CharField
(
max_length
=
100
,
default
=
""
)
venue
=
models
.
CharField
(
max_length
=
100
,
default
=
""
)
def
__str__
(
self
):
return
'{} {}'
.
format
(
self
.
mode
,
self
.
venue
)
return
"{} {} {} {}"
.
format
(
self
.
target_datetime
,
self
.
activity
,
self
.
estimated_hours
,
self
.
course
,
self
.
location
)
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