Sfoglia il codice sorgente

Closes #23740: Note deprecation in custom link form help text

Add the deprecation notice to the link text and link URL help text so
authors editing a custom link see it without reading the docs.
Jason Novinger 2 giorni fa
parent
commit
335969753a
1 ha cambiato i file con 14 aggiunte e 4 eliminazioni
  1. 14 4
      netbox/extras/forms/model_forms.py

+ 14 - 4
netbox/extras/forms/model_forms.py

@@ -363,14 +363,24 @@ class CustomLinkForm(ChangelogMessageMixin, OwnerMixin, forms.ModelForm):
             'link_text': forms.Textarea(attrs={'class': 'font-monospace'}),
             'link_url': forms.Textarea(attrs={'class': 'font-monospace'}),
         }
+        # TODO: Remove in NetBox v5.0
         help_texts = {
             'link_text': _(
                 "Jinja2 template code for the link text. Reference the object as {example}. Links "
-                "which render as empty text will not be displayed."
-            ).format(example="<code>{{ object }}</code>"),
+                "which render as empty text will not be displayed. Direct access to the in-memory "
+                "objects ({names}) is deprecated and will be removed in NetBox v5.0."
+            ).format(
+                example="<code>{{ object }}</code>",
+                names="<code>object</code>, <code>user</code>, <code>perms</code>",
+            ),
             'link_url': _(
-                "Jinja2 template code for the link URL. Reference the object as {example}."
-            ).format(example="<code>{{ object }}</code>"),
+                "Jinja2 template code for the link URL. Reference the object as {example}. Direct "
+                "access to the in-memory objects ({names}) is deprecated and will be removed in "
+                "NetBox v5.0."
+            ).format(
+                example="<code>{{ object }}</code>",
+                names="<code>object</code>, <code>user</code>, <code>perms</code>",
+            ),
         }