Skip to content

Commit 11771a9

Browse files
committed
Refactor ANNCSU API initialization to use project primary key
1 parent 71c5b16 commit 11771a9

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

qpdnd/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def send_anncsu_pdnd_task(anncsu_project, send_type, task):
114114
)
115115

116116
# Instance sepcific API class
117-
api = MAP_API_CLASS[anncsu_project.api_type](anncsu_project, send_type, process_info)
117+
api = MAP_API_CLASS[anncsu_project.api_type](anncsu_project.pk, send_type, process_info)
118118

119119
# Store results
120120
results = api.send_features()

qpdnd/utils/anncsu.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
Coordinate,
2424
TipoOperazione
2525
)
26+
from qpdnd.models import ANNCSUProject
2627

2728
from qpdnd.settings import (
2829
_ANNCSU_SENDED_STATUS,
@@ -52,14 +53,14 @@ class ANNCSUPDNDAPI(object):
5253
api_url = None
5354

5455

55-
def __init__(self, anncsu_project, send_type, process_info=None):
56+
def __init__(self, anncsu_project_pk, send_type, process_info=None):
5657
"""
5758
Constructor
58-
:param anncsu_project: ANNCSUProject instance
59+
:param anncsu_project_pk: Primary key of ANNCSUProject instance
5960
:param process_info: huey_monitor.ProcessInfo instance
6061
"""
6162

62-
self.anncsu_project = anncsu_project
63+
self.anncsu_project = ANNCSUProject.objects.get(pk=anncsu_project_pk)
6364
self.send_type = send_type
6465
self.process_info = process_info
6566

0 commit comments

Comments
 (0)