Skip to content

Commit d4ca438

Browse files
committed
fix impot data command
1 parent ef23b18 commit d4ca438

File tree

5 files changed

+34
-9
lines changed

5 files changed

+34
-9
lines changed

backend/dev-requirements.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ certifi==2024.6.2
2121
# -c requirements.txt
2222
# requests
2323
charset-normalizer==3.3.2
24-
# via requests
24+
# via
25+
# -c requirements.txt
26+
# requests
2527
click==8.1.7
2628
# via
2729
# black
@@ -49,7 +51,9 @@ flake8==7.1.0
4951
greenlet==3.0.3
5052
# via bpython
5153
idna==3.7
52-
# via requests
54+
# via
55+
# -c requirements.txt
56+
# requests
5357
isort==5.13.2
5458
# via -r dev-requirements.in
5559
mccabe==0.7.0
@@ -84,7 +88,9 @@ python-dateutil==2.9.0.post0
8488
pyxdg==0.28
8589
# via bpython
8690
requests==2.32.3
87-
# via bpython
91+
# via
92+
# -c requirements.txt
93+
# bpython
8894
six==1.16.0
8995
# via
9096
# -c requirements.txt

backend/project/observations/management/commands/import_data.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ def get_source(self):
3939
return self.source
4040

4141
def get_category(self, feature):
42-
try:
43-
return ObservationCategory.objects.filter(
44-
label=self.mapping_category.get(feature.get("id_event_type"))
45-
).last()
46-
except ObservationCategory.DoesNotExist:
42+
category = ObservationCategory.objects.filter(
43+
label=self.mapping_category.get(feature.get("id_event_type"))
44+
).last()
45+
if category:
46+
return category
47+
else:
4748
return ObservationCategory.add_root(
4849
label=self.mapping_category.get(feature.get("id_event_type")),
4950
)

backend/requirements.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ djangorestframework
44
djangorestframework-gis
55
drf-spectacular
66
django-filter
7+
requests
78
pillow
89
sorl-thumbnail
910
pymemcache

backend/requirements.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ botocore==1.34.140
1919
# boto3
2020
# s3transfer
2121
certifi==2024.6.2
22-
# via sentry-sdk
22+
# via
23+
# requests
24+
# sentry-sdk
25+
charset-normalizer==3.3.2
26+
# via requests
2327
django==5.0.7
2428
# via
2529
# -r requirements.in
@@ -59,6 +63,8 @@ drf-spectacular==0.27.2
5963
# via -r requirements.in
6064
gunicorn==22.0.0
6165
# via -r requirements.in
66+
idna==3.7
67+
# via requests
6268
inflection==0.5.1
6369
# via drf-spectacular
6470
jmespath==1.0.1
@@ -89,6 +95,8 @@ referencing==0.35.1
8995
# via
9096
# jsonschema
9197
# jsonschema-specifications
98+
requests==2.32.3
99+
# via -r requirements.in
92100
rpds-py==0.18.1
93101
# via
94102
# jsonschema
@@ -110,4 +118,5 @@ uritemplate==4.1.1
110118
urllib3==2.2.2
111119
# via
112120
# botocore
121+
# requests
113122
# sentry-sdk

changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
CHANGE LOG
22
==========
33

4+
1.0.2 (2024-07-24)
5+
----------------------
6+
7+
**Bugfix**
8+
9+
- Import data command does not work
10+
11+
412
1.0.1 (2024-07-24)
513
----------------------
614

0 commit comments

Comments
 (0)