Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_nicsbabes
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
Nics De Vega
midterm_nicsbabes
Commits
598be356
Commit
598be356
authored
Mar 06, 2023
by
Gabriel Geraldo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
created admin panel and populated models of app widget_calendar
parent
48c53b1f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
6 deletions
+23
-6
admin.py
widget_nicsbabes/widget_calendar/admin.py
+18
-1
models.py
widget_nicsbabes/widget_calendar/models.py
+5
-5
No files found.
widget_nicsbabes/widget_calendar/admin.py
View file @
598be356
from
django.contrib
import
admin
from
django.contrib
import
admin
from
.models
import
Location
,
Event
# Register your models here.
class
LocationAdmin
(
admin
.
ModelAdmin
):
model
=
Location
list_display
=
(
"venue"
,
"mode"
)
search_fields
=
(
"venue"
,)
list_filter
=
(
"mode"
,)
class
EventAdmin
(
admin
.
ModelAdmin
):
model
=
Event
list_display
=
(
"course"
,
"activity"
,
"target_datetime"
)
search_fields
=
(
"activity"
,
"course"
)
list_filter
=
(
"course"
,)
admin
.
site
.
register
(
Location
,
LocationAdmin
)
admin
.
site
.
register
(
Event
,
EventAdmin
)
widget_nicsbabes/widget_calendar/models.py
View file @
598be356
...
@@ -3,9 +3,9 @@ from assignments.models import Course
...
@@ -3,9 +3,9 @@ from assignments.models import Course
class
Location
(
models
.
Model
):
class
Location
(
models
.
Model
):
ONSITE
=
'
onsite
'
ONSITE
=
'
ONSITE
'
ONLINE
=
'
online
'
ONLINE
=
'
ONLINE
'
HYBRID
=
'
hybrid
'
HYBRID
=
'
HYBRID
'
MODE_CHOICES
=
[
MODE_CHOICES
=
[
(
ONSITE
,
'Onsite'
),
(
ONSITE
,
'Onsite'
),
(
ONLINE
,
'Online'
),
(
ONLINE
,
'Online'
),
...
@@ -21,8 +21,8 @@ class Location(models.Model):
...
@@ -21,8 +21,8 @@ class Location(models.Model):
def
__str__
(
self
):
def
__str__
(
self
):
return
'{} ({})'
.
format
(
return
'{} ({})'
.
format
(
self
.
mod
e
,
self
.
venu
e
,
self
.
titl
e
self
.
mod
e
)
)
...
...
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