Skip to content

A proper way to deal with export templates #8065

Answered by candlerb
damiankaczkowski asked this question in Q&A
Discussion options

You must be logged in to vote

I am wondering what is the best way to get the list of attributes that "obj" holds plus their values.

To explore what attributes are available on a given object, the nbshell is a useful tool.

cd /opt/netbox
. venv/bin/activate
python3 netbox/manage.py nbshell

>>> obj = Device.objects.first()
>>> dir(obj)
['DoesNotExist', 'Meta', 'MultipleObjectsReturned', '__class__', '__delattr__', ...

The source code for the model is also a good place to look, e.g. for Device

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by damiankaczkowski
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants