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
48c53b1f
Commit
48c53b1f
authored
Mar 06, 2023
by
Gabriel Geraldo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented models of app widget_calendar
parent
598967ea
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
1 deletion
+74
-1
0001_initial.py
widget_nicsbabes/widget_calendar/migrations/0001_initial.py
+35
-0
models.py
widget_nicsbabes/widget_calendar/models.py
+39
-1
No files found.
widget_nicsbabes/widget_calendar/migrations/0001_initial.py
0 → 100644
View file @
48c53b1f
# Generated by Django 4.1.7 on 2023-03-06 07:35
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
initial
=
True
dependencies
=
[
(
'assignments'
,
'0002_alter_assignment_course'
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Location'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'mode'
,
models
.
CharField
(
choices
=
[(
'onsite'
,
'Onsite'
),
(
'online'
,
'Online'
),
(
'hybrid'
,
'Hybrid'
)],
default
=
'onsite'
,
max_length
=
6
)),
(
'venue'
,
models
.
CharField
(
max_length
=
255
)),
],
),
migrations
.
CreateModel
(
name
=
'Event'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'target_datetime'
,
models
.
DateTimeField
()),
(
'activity'
,
models
.
TextField
()),
(
'estimated_hours'
,
models
.
FloatField
()),
(
'course'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'assignments.course'
)),
(
'location'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'widget_calendar.location'
)),
],
),
]
widget_nicsbabes/widget_calendar/models.py
View file @
48c53b1f
from
django.db
import
models
from
django.db
import
models
from
assignments.models
import
Course
class
Location
(
models
.
Model
):
ONSITE
=
'onsite'
ONLINE
=
'online'
HYBRID
=
'hybrid'
MODE_CHOICES
=
[
(
ONSITE
,
'Onsite'
),
(
ONLINE
,
'Online'
),
(
HYBRID
,
'Hybrid'
),
]
mode
=
models
.
CharField
(
max_length
=
6
,
choices
=
MODE_CHOICES
,
default
=
ONSITE
,
)
venue
=
models
.
CharField
(
max_length
=
255
)
def
__str__
(
self
):
return
'{} ({})'
.
format
(
self
.
mode
,
self
.
title
)
class
Event
(
models
.
Model
):
target_datetime
=
models
.
DateTimeField
()
activity
=
models
.
TextField
()
estimated_hours
=
models
.
FloatField
()
location
=
models
.
ForeignKey
(
Location
,
on_delete
=
models
.
CASCADE
)
course
=
models
.
ForeignKey
(
Course
,
on_delete
=
models
.
CASCADE
)
def
__str__
(
self
):
return
'{} by {}'
.
format
(
self
.
activity
,
self
.
course
)
\ No newline at end of file
# Create your models here.
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