mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-08 04:28:12 +08:00
Delete deprecated imports and unwrapping (#261)
* delete old code * remove imports
This commit is contained in:
@@ -1,8 +1,3 @@
|
|||||||
import django
|
|
||||||
|
|
||||||
VERSION = (1, 7, 6)
|
VERSION = (1, 7, 6)
|
||||||
|
|
||||||
if django.VERSION < (3, 2):
|
|
||||||
default_app_config = "django_q.apps.DjangoQConfig"
|
|
||||||
|
|
||||||
__all__ = ["conf", "cluster", "models", "tasks"]
|
__all__ = ["conf", "cluster", "models", "tasks"]
|
||||||
|
|||||||
+1
-11
@@ -2,7 +2,6 @@ from datetime import datetime, timedelta
|
|||||||
from keyword import iskeyword
|
from keyword import iskeyword
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
from django import get_version
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
@@ -15,7 +14,6 @@ from django.utils.translation import gettext_lazy as _
|
|||||||
|
|
||||||
# External
|
# External
|
||||||
from picklefield import PickledObjectField
|
from picklefield import PickledObjectField
|
||||||
from picklefield.fields import dbsafe_decode
|
|
||||||
|
|
||||||
# Local
|
# Local
|
||||||
from django_q.conf import croniter
|
from django_q.conf import croniter
|
||||||
@@ -59,7 +57,7 @@ class Task(models.Model):
|
|||||||
.exclude(success=False)
|
.exclude(success=False)
|
||||||
.values_list("result", flat=True)
|
.values_list("result", flat=True)
|
||||||
)
|
)
|
||||||
return decode_results(values)
|
return values
|
||||||
|
|
||||||
def group_result(self, failures=False):
|
def group_result(self, failures=False):
|
||||||
if self.group:
|
if self.group:
|
||||||
@@ -356,11 +354,3 @@ class OrmQ(models.Model):
|
|||||||
app_label = "django_q"
|
app_label = "django_q"
|
||||||
verbose_name = _("Queued task")
|
verbose_name = _("Queued task")
|
||||||
verbose_name_plural = _("Queued tasks")
|
verbose_name_plural = _("Queued tasks")
|
||||||
|
|
||||||
|
|
||||||
# Backwards compatibility for Django 1.7
|
|
||||||
def decode_results(values):
|
|
||||||
if get_version().split(".")[1] == "7":
|
|
||||||
# decode values in 1.7
|
|
||||||
return [dbsafe_decode(v) for v in values]
|
|
||||||
return values
|
|
||||||
|
|||||||
Reference in New Issue
Block a user