Skip to content

Unable to add tags to a new vlan in 'scripts' #6213

Answered by PieterL75
PieterL75 asked this question in Q&A
Discussion options

You must be logged in to vote

Jeremy,

Thank you for taking time to look into this.

I have this code now :

`
vlangroup=VLANGroup.objects.get(id=3)
newvid = '1234'
vlanname = "testvlan"
newvlan = VLAN(
vid = newvid,
name = vlanname,
group = vlangroup,
)
newvlan.save()
self.log_success(f"Vlan tags : {newvlan.tags}")

newvlan.tag.add(16)
newvlan.tag.add(9)
newvlan.tag.add(3)
newvlan.save()

newvlan=VLAN.objects.get(vid=1234)
self.log_success(f"Vlan tags : {newvlan.tags}")
`

But I still get the 'ipam.VLAN.None'.

Really strange, it must be my coding skill I guess. Unfortunattely, I'm not able to find some good example

Pieter

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@PieterL75
Comment options

@candlerb
Comment options

@PieterL75
Comment options

Answer selected by PieterL75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #6212 on April 19, 2021 15:48.