Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use display field in Record.__str__() to support future models #419

Merged
merged 2 commits into from
Dec 11, 2021

Conversation

markkuleinio
Copy link
Contributor

@markkuleinio markkuleinio commented Dec 5, 2021

This PR supersedes #388 for clarity, and should fix #417, example:

>>> ss = list(netbox.ipam.services.all())
>>> ss[0].ipaddresses
[1.1.1.1/32]
>>>

See also: netbox-community/netbox#5992 (= NetBox 2.11.0 added the display fields)

@markkuleinio
Copy link
Contributor Author

In addition to this PR, do you @zachmoody see us adding new custom models in pynetbox as they appear in NetBox? I mean, I could add a PR adding models like extras.Tags and so on, if desired. But if we are not going to add new models frequently, I'm not sure about the benefit of adding them at all (unless there is a need like with the model fields).

@zachmoody
Copy link
Contributor

In addition to this PR, do you @zachmoody see us adding new custom models in pynetbox as they appear in NetBox? I mean, I could add a PR adding models like extras.Tags and so on, if desired. But if we are not going to add new models frequently, I'm not sure about the benefit of adding them at all (unless there is a need like with the model fields).

Models were always intended to just handle outliers. Kind of a judgement call on when to move that behavior into the parent class. I'd say if more than a few models behave similarly we should think about it. This totally make sense though if display is going to be the new human-friendly field going forward.

@zachmoody zachmoody merged commit 13f0915 into netbox-community:master Dec 11, 2021
@markkuleinio markkuleinio deleted the use-display-field branch December 11, 2021 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The ipaddresses of a Service return IP elements with an empty representation
2 participants