Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for abstract base models improved. (#516) #534

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

diegocastrum
Copy link
Contributor

Model classes moved into a models.py directory, which exports by default only the default django-celery-beat model classes now from models.generic.py.

managers.py moved into models.py directory, because it's something that is needed only by models.

Model classes moved into a `models.py` directory, which exports by
default only the default `django-celery-beat` model classes now from
`models.generic.py`.

`managers.py` moved into `models.py` directory, because it's something
that is needed only by models.
@SimeonAleksov
Copy link

@auvipy any plans to merge this soon?

@auvipy
Copy link
Member

auvipy commented Apr 22, 2022

no, there are other priorities for a long overdue release

@auvipy auvipy self-requested a review April 22, 2022 10:55
`crontab_schedule_celery_timezone` wasn't exported properly and
raised an `AttributeError` when applying migrations.
…ry#516)

when
`CELERY_BEAT_(?:PERIODICTASKS?|(?:CRONTAB|INTERVAL|SOLAR|CLOCKED)SCHEDULE)_MODEL`
constants are defined in django `settings`.

Providing the `app_label.model_name` of your own models as value for the
constants
`CELERY_BEAT_(?:PERIODICTASKS?|(?:CRONTAB|INTERVAL|SOLAR|CLOCKED)SCHEDULE)_MODEL`
will let `django_celery_beat.scheduler` use the custom models instead of
the default ones (aka generic models, in this context/pull-request):

```python
CELERY_BEAT_PERIODICTASK_MODEL = "app_label.model_name"
CELERY_BEAT_PERIODICTASKS_MODEL = "app_label.model_name"
CELERY_BEAT_CRONTABSCHEDULE_MODEL = "app_label.model_name"
CELERY_BEAT_INTERVALSCHEDULE_MODEL = "app_label.model_name"
CELERY_BEAT_SOLARSCHEDULE_MODEL = "app_label.model_name"
CELERY_BEAT_CLOCKEDSCHEDULE_MODEL = "app_label.model_name"
```

Doing this we add support to automatically bypass the default
`django_celery_beat` models without forcing developers to overwrite the
whole `django_celery_beat.scheduler` in projects where the default
models doesn't fit the requirements

I updated the `README.rst` with a small explanation about how this work

Additonal information:
* related issue: celery#516
* pull-request: celery#534
@kevindice
Copy link

I do think this would be useful - for example, I'd like to add a description field to have a human-readable description for the interval/cron/solar schedule.

@cclauss
Copy link
Contributor

cclauss commented Apr 28, 2024

Git conflicts — please rebase.

@diegocastrum
Copy link
Contributor Author

I will try to do it asap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants