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

Remove superseded ExtendedQuerySet as it's functionality is built into Django since 1.7 #563

Merged
merged 3 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions django_celery_beat/managers.py

This file was deleted.

6 changes: 2 additions & 4 deletions django_celery_beat/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from django.db.models import signals
from django.utils.translation import gettext_lazy as _

from . import managers, validators
from . import querysets, validators
from .tzcrontab import TzAwareCrontab
from .utils import make_aware, now
from .clockedschedule import clocked
Expand Down Expand Up @@ -370,8 +370,6 @@ class PeriodicTasks(models.Model):
ident = models.SmallIntegerField(default=1, primary_key=True, unique=True)
last_update = models.DateTimeField(null=False)

objects = managers.ExtendedManager()

@classmethod
def changed(cls, instance, **kwargs):
if not instance.no_changes:
Expand Down Expand Up @@ -541,7 +539,7 @@ class PeriodicTask(models.Model):
'Detailed description about the details of this Periodic Task'),
)

objects = managers.PeriodicTaskManager()
objects = querysets.PeriodicTaskQuerySet.as_manager()
no_changes = False

class Meta:
Expand Down
12 changes: 12 additions & 0 deletions django_celery_beat/querysets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""Model querysets."""
from django.db import models


class PeriodicTaskQuerySet(models.QuerySet):
"""
QuerySet for the PeriodicTask model that
will be used as it's default manager.
"""

def enabled(self):
return self.filter(enabled=True)
5 changes: 3 additions & 2 deletions django_celery_beat/schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,10 @@ def to_model_schedule(cls, schedule):

@classmethod
def from_entry(cls, name, app=None, **entry):
return cls(PeriodicTask._default_manager.update_or_create(
obj, created = PeriodicTask._default_manager.update_or_create(
name=name, defaults=cls._unpack_fields(**entry),
), app=app)
)
return cls(obj, app=app)

@classmethod
def _unpack_fields(cls, schedule,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
=====================================================
``django_celery_beat.managers``
``django_celery_beat.querysets``
=====================================================

.. contents::
:local:
.. currentmodule:: django_celery_beat.managers
.. currentmodule:: django_celery_beat.querysets

.. automodule:: django_celery_beat.managers
.. automodule:: django_celery_beat.querysets
:members:
:undoc-members:
2 changes: 1 addition & 1 deletion docs/reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
django-celery-beat
django-celery-beat.models
django-celery-beat.tzcrontab
django-celery-beat.managers
django-celery-beat.querysets
django-celery-beat.schedulers
django-celery-beat.admin
django-celery-beat.utils
Expand Down