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

Prepopulation of custom fields #1416

Closed
AnythingOverIP opened this issue Aug 9, 2017 · 3 comments
Closed

Prepopulation of custom fields #1416

AnythingOverIP opened this issue Aug 9, 2017 · 3 comments

Comments

@AnythingOverIP
Copy link

Issue type: Feature request

**Python version: 3.5.2
**NetBox version: 2.1.2

I would like to be able to pre-populate fieds.

In example, for each sites, I have Custom fields that should contain URLs that we use to document those. We use the "Facility" field to put in the location code (A####)

this is similar to #969 and #600

So for each URL custom property, I would like to set a default value of the base URL + the content of facility field for this site:
* http://internal.site.com/locations/{facility}
* http://internal.site.com/{facility}/folder
* http://internal.site.com/default.aspx?ABBR=?{facility}

The admin should have the luxury to override the default value if needed.

It would be useful to be able to refer not only to the out of the box field, but also to other Custom Fields. An example would be Lat Long coordinates being reused for a link towards a map provider site.

@jeremystretch
Copy link
Member

Custom fields already allow you to set a default value. What are you proposing that is not covered by #600 or #969?

@AnythingOverIP
Copy link
Author

Indeed, I can have a default value, but it is my understanding that I cannot use variables that refer to other fields of the given site, right?

I currently have default values that I edit manually every time I create a site, and type in the location code. For each site I create into NetBox, I have about 5 or 6 URLS in custom properties to maintain, that could be automated by those variables.

The goal of my use case is when creating a site, when I enter a location code in the facility field and click save, the URLs are updated to include the location code I provided in the facility field.
Something like http://internal.site.com/locations/{facility} would then show http://internal.site.com/locations/A1234 when not in edit mode (A1234 being the content of the Facility field.

#600 or #969 were really axed towards the devices information. I created this FR to ensure it's captured that it would be also available for site information. I also haven't seen anybody that were requiring to reference a custom field into another custom field. It would be useful when storing LAT/LONG coordinates in custom fields, to be able to recreate an URL from those...

@jeremystretch
Copy link
Member

The goal of my use case is when creating a site, when I enter a location code in the facility field and click save, the URLs are updated to include the location code I provided in the facility field.

There's no reason to duplicate the value of the facility field in the database. The {facility} placeholder would be rendered upon request and replaced with the value of the site's facility field. This is what #600/#969 aim to implement. I'm going to close this out as I'm confident your use case will be addressed by the implementation of one or both of those FRs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants