Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
MOOC packages by hacklab
django-courses
Commits
555f4d58
Commit
555f4d58
authored
Dec 07, 2021
by
Matheus Miranda
Browse files
Add scheduling module
parent
f1141e45
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
1 deletion
+63
-1
courses/scheduling/__init__.py
courses/scheduling/__init__.py
+1
-0
courses/scheduling/apps.py
courses/scheduling/apps.py
+5
-0
courses/scheduling/migrations/0001_initial.py
courses/scheduling/migrations/0001_initial.py
+28
-0
courses/scheduling/migrations/__init__.py
courses/scheduling/migrations/__init__.py
+0
-0
courses/scheduling/models.py
courses/scheduling/models.py
+28
-0
courses/signals.py
courses/signals.py
+1
-1
No files found.
courses/scheduling/__init__.py
0 → 100644
View file @
555f4d58
__version__
=
'0.0.1'
courses/scheduling/apps.py
0 → 100644
View file @
555f4d58
from
django.apps
import
AppConfig
class
CoursesSchedulingConfig
(
AppConfig
):
name
=
'courses.scheduling'
courses/scheduling/migrations/0001_initial.py
0 → 100644
View file @
555f4d58
# Generated by Django 2.2.24 on 2021-12-07 11:48
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
initial
=
True
dependencies
=
[
]
operations
=
[
migrations
.
CreateModel
(
name
=
'ScheduledTask'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'task_id'
,
models
.
IntegerField
()),
(
'release_date'
,
models
.
DateTimeField
(
blank
=
True
,
default
=
None
,
null
=
True
,
verbose_name
=
'Date'
)),
(
'created_at'
,
models
.
DateTimeField
(
auto_now_add
=
True
)),
(
'updated_at'
,
models
.
DateTimeField
(
auto_now
=
True
)),
],
options
=
{
'verbose_name'
:
'ScheduledTask'
,
'verbose_name_plural'
:
'ScheduledTasks'
,
},
),
]
courses/scheduling/migrations/__init__.py
0 → 100644
View file @
555f4d58
courses/scheduling/models.py
0 → 100644
View file @
555f4d58
from
django.db
import
models
from
django.conf
import
settings
from
django.urls
import
reverse_lazy
from
courses.models
import
Lesson
,
Unit
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.contrib.contenttypes.fields
import
GenericRelation
class
ScheduledTask
(
models
.
Model
):
class
Meta
:
verbose_name
=
_
(
'ScheduledTask'
)
verbose_name_plural
=
_
(
'ScheduledTasks'
)
task_id
=
models
.
IntegerField
()
notes
=
GenericRelation
(
Lesson
,
Unit
,)
release_date
=
models
.
DateTimeField
(
_
(
'Date'
),
null
=
True
,
blank
=
True
,
default
=
None
,
)
created_at
=
models
.
DateTimeField
(
auto_now_add
=
True
)
updated_at
=
models
.
DateTimeField
(
auto_now
=
True
)
courses/signals.py
View file @
555f4d58
...
...
@@ -16,4 +16,4 @@ def lesson_created_or_updated(sender, instance: Lesson, **kwargs):
@
receiver
(
pre_save
,
sender
=
Unit
)
def
unit_created_or_updated
(
sender
,
instance
:
Unit
,
**
kwargs
):
previous_unit
=
Unit
.
objects
.
get
(
id
=
instance
.
id
)
publish_unit
.
apply_async
(
args
=
[
instance
.
id
],
eta
=
instance
.
release_date
)
#
publish_unit.apply_async(args=[instance.id], eta=instance.release_date)
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