CustomScripts: 'ContactAssignment' has no attribute 'objects #17265
Unanswered
fneumann-tubs
asked this question in
Help Wanted!
Replies: 2 comments
-
This is not a bug in NetBox. Please don't submit bug reports for help writing custom scripts. |
Beta Was this translation helpful? Give feedback.
0 replies
-
The name you've chosen for your script ( |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Deployment Type
Self-hosted
NetBox Version
v4.0.9
Python Version
3.10
Steps to Reproduce
from extras.scripts import *
from extras.models import *
from tenancy.models import ContactRole, ContactAssignment, Contact, Tenant
class ContactAssignment(Script):
Expected Behavior
A new assginment should be created after run this small script between Max Mustermann and TestTenant
When I run the code in the nbshell without a CustomScript, the Contact is assigned to the Tenant.
Observed Behavior
An exception occurred: AttributeError: type object 'ContactAssignment' has no attribute 'objects'
Traceback (most recent call last):
File "/opt/netbox/netbox/extras/scripts.py", line 662, in _run_script
script.output = script.run(data, commit)
File "/opt/netbox/netbox/scripts/Aktualisierungsmanagement.py", line 36, in run
ContactAssignment.objects.create(object=tenant, contact=contact, role=role)
AttributeError: type object 'ContactAssignment' has no attribute 'objects'
Beta Was this translation helpful? Give feedback.
All reactions