Skip to content

Commit 3c90f19

Browse files
committed
Fix import export signatures
1 parent 9ec4d93 commit 3c90f19

File tree

11 files changed

+28
-30
lines changed

11 files changed

+28
-30
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ dependencies = [
4545
"django-cryptography-django5",
4646
"django-extensions==3.1.5",
4747
"django-filter==25.1",
48-
"django-import-export==4.3.10",
48+
"django-import-export==4.0.2",
4949
"django-money==3.4.1",
5050
"django-mptt==0.14",
5151
"django-prometheus==2.2.0",

requirements/dev.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ django-extensions==3.1.5
115115
# via ralph (pyproject.toml)
116116
django-filter==25.1
117117
# via ralph (pyproject.toml)
118-
django-import-export==4.3.10
118+
django-import-export==4.0.2
119119
# via ralph (pyproject.toml)
120120
django-js-asset==3.1.2
121121
# via django-mptt
@@ -545,7 +545,7 @@ stevedore==5.4.1
545545
# oslo-config
546546
# python-ironicclient
547547
# python-keystoneclient
548-
tablib==3.8.0
548+
tablib==3.5.0
549549
# via django-import-export
550550
tblib==3.1.0
551551
# via ralph (pyproject.toml)

requirements/docs.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ django-extensions==3.1.5
8989
# via ralph (pyproject.toml)
9090
django-filter==25.1
9191
# via ralph (pyproject.toml)
92-
django-import-export==4.3.10
92+
django-import-export==4.0.2
9393
# via ralph (pyproject.toml)
9494
django-js-asset==3.1.2
9595
# via django-mptt
@@ -442,7 +442,7 @@ stevedore==5.4.1
442442
# oslo-config
443443
# python-ironicclient
444444
# python-keystoneclient
445-
tablib==3.8.0
445+
tablib==3.5.0
446446
# via django-import-export
447447
tblib==3.1.0
448448
# via ralph (pyproject.toml)

requirements/prod.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ django-extensions==3.1.5
8484
# via ralph (pyproject.toml)
8585
django-filter==25.1
8686
# via ralph (pyproject.toml)
87-
django-import-export==4.3.10
87+
django-import-export==4.0.2
8888
# via ralph (pyproject.toml)
8989
django-js-asset==3.1.2
9090
# via django-mptt
@@ -390,7 +390,7 @@ stevedore==5.4.1
390390
# oslo-config
391391
# python-ironicclient
392392
# python-keystoneclient
393-
tablib==3.8.0
393+
tablib==3.5.0
394394
# via django-import-export
395395
tblib==3.1.0
396396
# via ralph (pyproject.toml)

requirements/test.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ django-extensions==3.1.5
110110
# via ralph (pyproject.toml)
111111
django-filter==25.1
112112
# via ralph (pyproject.toml)
113-
django-import-export==4.3.10
113+
django-import-export==4.0.2
114114
# via ralph (pyproject.toml)
115115
django-js-asset==3.1.2
116116
# via django-mptt
@@ -491,7 +491,7 @@ stevedore==5.4.1
491491
# oslo-config
492492
# python-ironicclient
493493
# python-keystoneclient
494-
tablib==3.8.0
494+
tablib==3.5.0
495495
# via django-import-export
496496
tblib==3.1.0
497497
# via ralph (pyproject.toml)

src/ralph/admin/mixins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,11 +407,11 @@ def get_export_queryset(self, request):
407407
queryset = queryset.prefetch_related(*resource_prefetch_related)
408408
return list(queryset)
409409

410-
def get_export_resource_classes(self):
410+
def get_export_resource_classes(self, request):
411411
"""
412412
If `export_class` is defined in Admin, use it.
413413
"""
414-
resource_classes = self.get_resource_classes()
414+
resource_classes = self.get_resource_classes(request)
415415
export_classes = [
416416
getattr(resource_class, "export_class", None)
417417
for resource_class in resource_classes

src/ralph/assets/admin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class ServiceEnvironmentAdmin(CustomFieldValueAdminMixin, RalphAdmin):
114114
search_fields = ["service__name", "environment__name"]
115115
list_select_related = ["service", "environment"]
116116
raw_id_fields = ["service", "environment"]
117-
resource_class = resources.ServiceEnvironmentResource
117+
resource_classes = [resources.ServiceEnvironmentResource]
118118
fields = ("service", "environment", "remarks", "tags")
119119

120120

@@ -215,7 +215,7 @@ class ServiceAdmin(RalphAdmin):
215215
"business_owners",
216216
"technical_owners",
217217
]
218-
resource_class = resources.ServiceResource
218+
resource_classes = [resources.ServiceResource]
219219
change_views = [ServiceBaseObjects]
220220

221221

src/ralph/data_center/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ class DataCenterAssetAdmin(
372372
if settings.ENABLE_DNSAAS_INTEGRATION:
373373
change_views += [DNSView]
374374
show_transition_history = True
375-
resource_class = resources.DataCenterAssetResource
375+
resource_classes = [resources.DataCenterAssetResource]
376376
list_display = [
377377
"hostname",
378378
"status",

src/ralph/data_importer/tests/test_export.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ def _export(self, model, filters=None):
5353

5454
file_format = RawFormat()
5555
queryset = admin_class.get_export_queryset(request)
56-
export_data = admin_class.get_export_data(
57-
file_format, queryset, request=request
58-
)
56+
export_data = admin_class.get_export_data(file_format, request, queryset)
5957
return export_data
6058

6159
def _init(self, num=10):

src/ralph/lib/transitions/tests/factories.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from factory.fuzzy import FuzzyText
55

66
from ralph.accounts.tests.factories import UserFactory
7-
from ralph.back_office.models import BackOfficeAsset
7+
from ralph.back_office.models import BackOfficeAsset, BackOfficeAssetStatus
88
from ralph.back_office.tests.factories import BackOfficeAssetFactory
99
from ralph.data_center.models import DataCenterAsset
1010
from ralph.data_center.tests.factories import DataCenterAssetFullFactory
@@ -32,8 +32,8 @@ class Meta:
3232
class TransitionFactory(DjangoModelFactory):
3333
name = FuzzyText(length=10)
3434
model = SubFactory(TransitionModelFactory)
35-
source = ["new", "used"]
36-
target = "used"
35+
source = [BackOfficeAssetStatus.new.id, BackOfficeAssetStatus.used.id]
36+
target = BackOfficeAssetStatus.used.id
3737

3838
class Meta:
3939
model = Transition

0 commit comments

Comments
 (0)