Closes: #19793 - Nav menu link customization #19794
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: #19793
Changes the
PluginMenuItem
andPluginMenuButton
classes to handle an alternate pre-rendered literalurl
init parameter, rather than just supportinglink
which must be a view name suitable for{% url %}
.This allows plugin authors to supply link target URLs that might require additional (arbitrary) kwargs for resolution, rather than relying on built-in NetBox view names.
Note that Django does not provide a supported way of passing arbitrary kwargs to
{% url %}
; the params must be known in advance and specified explicitly (i.e.{% url 'view_name' arg1='foo' arg2='bar' %}
). This prevents us from implementing this functionality in a more elegant way, i.e. being able to pass alink_kwargs
dict which could then be plugged into the template directly like{% url item.link **item.link_kwargs %}
.