Skip to content

Commit af06260

Browse files
author
Laura
authored
Merge pull request #257 from laurapanzariello/master
associate more than one equipments to the same as
2 parents dfb58e6 + a3d4659 commit af06260

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

networkapi/api_asn/models.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@ def create_v4(self, as_map):
6868
self.description = as_map.get('description')
6969
self.save()
7070

71-
if as_map.get("equip_id"):
71+
if len(as_map.get("equip_id")):
7272
asn_equip = AsnEquipment()
73-
asn_equip.create_v4(dict(equipment=as_map.get("equip_id"),
74-
asn=self.id))
73+
for equip in as_map.get("equip_id"):
74+
asn_equip.create_v4(dict(equipment=equip,
75+
asn=self.id))
7576

7677
def update_v4(self, as_map):
7778
"""Update ASN."""

networkapi/api_asn/v4/specs/as_post.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"type": "string"
1919
},
2020
"equip_id": {
21-
"type": "integer"
21+
"type": "array"
2222
}
2323
},
2424
"required": [

0 commit comments

Comments
 (0)