-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fixed signals can not connect to OneToOneField (#572) * Remove unused import. * Changed `PeriodicTasks.pre_save` and `PeriodicTasks.pre_delete` in `PeriodicTasks.save` and `PeriodicTasks.delete` * Update django_celery_beat/models.py * Append the unit-test * Correction of notes * Append test-case for: O2O-rel instance be deleted * Add the docs * Format code according to `pycodestyle` Co-authored-by: Asif Saif Uddin <auvipy@gmail.com>
- Loading branch information
Showing
8 changed files
with
143 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
def signals_connect(): | ||
""" | ||
Connect to signals. | ||
""" | ||
from django.db.models import signals | ||
from .models import ( | ||
ClockedSchedule, | ||
PeriodicTask, | ||
PeriodicTasks, | ||
IntervalSchedule, | ||
CrontabSchedule, | ||
SolarSchedule | ||
) | ||
|
||
signals.pre_save.connect( | ||
PeriodicTasks.changed, sender=PeriodicTask | ||
) | ||
signals.pre_delete.connect( | ||
PeriodicTasks.changed, sender=PeriodicTask | ||
) | ||
|
||
signals.post_save.connect( | ||
PeriodicTasks.update_changed, sender=IntervalSchedule | ||
) | ||
signals.pre_delete.connect( | ||
PeriodicTasks.update_changed, sender=IntervalSchedule | ||
) | ||
|
||
signals.post_save.connect( | ||
PeriodicTasks.update_changed, sender=CrontabSchedule | ||
) | ||
signals.post_delete.connect( | ||
PeriodicTasks.update_changed, sender=CrontabSchedule | ||
) | ||
|
||
signals.post_save.connect( | ||
PeriodicTasks.update_changed, sender=SolarSchedule | ||
) | ||
signals.post_delete.connect( | ||
PeriodicTasks.update_changed, sender=SolarSchedule | ||
) | ||
|
||
signals.post_save.connect( | ||
PeriodicTasks.update_changed, sender=ClockedSchedule | ||
) | ||
signals.post_delete.connect( | ||
PeriodicTasks.update_changed, sender=ClockedSchedule | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 4.0.7 on 2022-10-13 05:09 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
('django_celery_beat', '0016_alter_crontabschedule_timezone'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='O2OToPeriodicTasks', | ||
fields=[ | ||
('periodictask_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='django_celery_beat.periodictask')), | ||
], | ||
bases=('django_celery_beat.periodictask',), | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from django_celery_beat.models import PeriodicTask | ||
|
||
|
||
class O2OToPeriodicTasks(PeriodicTask): | ||
""" | ||
The test-case model of OneToOne relation. | ||
""" | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters