netbox-community / netbox-qrcode

NetBox Plugin for generate QR Codes
Apache License 2.0
209 stars 31 forks source link

Feature Request: Use URL QR code represents in text label #44

Closed enpaul closed 10 months ago

enpaul commented 1 year ago

I'd like to be able to use the absolute URL that a QR code links to in the label text. This will help support use cases where the person looking at the device doesn't have a QR code scanner.

I think the ideal way to support this would be to pass the url variable as a part of the context to the custom template rendering option. Unless there's any objection to this approach, I can submit a PR to this effect.

k01ek commented 1 year ago

You can use text_template var in config for this, for example: 'device': { 'text_fields': ['name', 'serial'], 'text_template': 'http://localhost:8000{{ obj.get_absolute_url }}'