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
5adf85e4
Commit
5adf85e4
authored
3 years ago
by
Bruno Martin
Browse files
Options
Download
Email Patches
Plain Diff
revoke task when clearing scheduled tasks;
remove unused code
parent
6f0cc301
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
courses/signals.py
courses/signals.py
+7
-7
No files found.
courses/signals.py
View file @
5adf85e4
...
...
@@ -163,7 +163,6 @@ def create_or_update_events(instance, type):
else
:
# case when not published but there is no release date and there is prior event
# import ipdb;ipdb.set_trace()
if
type
==
'course'
:
# less DRY please
try
:
...
...
@@ -196,17 +195,18 @@ def create_or_update_events(instance, type):
if
event
:
event
.
delete
()
# case when not published but there is not release date and there is prior task scheduled
if
not
instance
.
release_date
and
st
.
release_date
and
st
.
task_hash
:
app
.
control
.
revoke
(
st
.
task_hash
)
st
.
delete
()
def
clear_scheduled_tasks
(
instance
):
# import ipdb;ipdb.set_trace()
content_type
=
ContentType
.
objects
.
get_for_model
(
instance
)
ScheduledTask
.
objects
.
filter
(
content_type
=
content_type
,
object_id
=
instance
.
id
).
delete
()
try
:
st
=
ScheduledTask
.
objects
.
get
(
content_type
=
content_type
,
object_id
=
instance
.
id
)
if
st
.
task_hash
:
app
.
control
.
revoke
(
st
.
task_hash
)
st
.
delete
()
except
ScheduledTask
.
DoesNotExist
:
pass
@
receiver
(
post_save
,
sender
=
Lesson
)
...
...
This diff is collapsed.
Click to expand it.
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