Skip to content

Commit 5e0e37f

Browse files
committed
refactor: Rename model retrieval functions for consistency to align with django auth's app.
Ref: #314 (comment)
1 parent 3dc476b commit 5e0e37f

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

django_celery_results/admin.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
ALLOW_EDITS = False
1111
pass
1212

13-
from .models.helpers import groupresult_model, taskresult_model
13+
from .models.helpers import get_group_result_model, get_task_result_model
1414

15-
GroupResult = groupresult_model()
16-
TaskResult = taskresult_model()
15+
GroupResult = get_group_result_model()
16+
TaskResult = get_task_result_model()
1717

1818

1919
class TaskResultAdmin(admin.ModelAdmin):

django_celery_results/backends/database.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
from kombu.exceptions import DecodeError
1414

1515
from ..models.helpers import (
16-
chordcounter_model,
17-
groupresult_model,
18-
taskresult_model,
16+
get_chord_counter_model,
17+
get_group_result_model,
18+
get_task_result_model,
1919
)
2020
from ..settings import get_task_props_extension
2121

@@ -33,9 +33,9 @@
3333
class DatabaseBackend(BaseDictBackend):
3434
"""The Django database backend, using models to store task state."""
3535

36-
TaskModel = taskresult_model()
37-
GroupModel = groupresult_model()
38-
ChordCounterModel = chordcounter_model()
36+
TaskModel = get_task_result_model()
37+
GroupModel = get_group_result_model()
38+
ChordCounterModel = get_chord_counter_model()
3939
subpolling_interval = 0.5
4040

4141
def exception_safe_to_retry(self, exc):

django_celery_results/models/helpers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from .generic import ChordCounter, GroupResult, TaskResult
66

77

8-
def taskresult_model():
8+
def get_task_result_model():
99
"""Return the TaskResult model that is active in this project."""
1010
if not hasattr(settings, 'CELERY_RESULTS_TASKRESULT_MODEL'):
1111
return TaskResult
@@ -27,7 +27,7 @@ def taskresult_model():
2727
)
2828

2929

30-
def chordcounter_model():
30+
def get_chord_counter_model():
3131
"""Return the ChordCounter model that is active in this project."""
3232

3333
if not hasattr(settings, 'CELERY_RESULTS_CHORDCOUNTER_MODEL'):
@@ -50,7 +50,7 @@ def chordcounter_model():
5050
)
5151

5252

53-
def groupresult_model():
53+
def get_group_result_model():
5454
"""Return the GroupResult model that is active in this project."""
5555
if not hasattr(settings, 'CELERY_RESULTS_GROUPRESULT_MODEL'):
5656
return GroupResult

0 commit comments

Comments
 (0)