1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Add notes to admin UI encouraging Jinja2 over legacy Django templating

This commit is contained in:
Jeremy Stretch
2020-08-03 14:09:32 -04:00
parent b410674f9e
commit 8517434733
2 changed files with 11 additions and 3 deletions

View File

@ -3,7 +3,6 @@ from django.contrib import admin
from utilities.forms import LaxURLField
from .models import CustomField, CustomFieldChoice, CustomLink, Graph, ExportTemplate, JobResult, Webhook
from .reports import get_report
def order_content_types(field):
@ -160,6 +159,10 @@ class GraphForm(forms.ModelForm):
class Meta:
model = Graph
exclude = ()
help_texts = {
'template_language': "<a href=\"https://jinja.palletsprojects.com\">Jinja2</a> is strongly recommended for "
"new graphs."
}
widgets = {
'source': forms.Textarea,
'link': forms.Textarea,
@ -195,6 +198,11 @@ class ExportTemplateForm(forms.ModelForm):
class Meta:
model = ExportTemplate
exclude = []
help_texts = {
'template_language': "<strong>Warning:</strong> Support for Django templating will be dropped in NetBox "
"v2.10. <a href=\"https://jinja.palletsprojects.com\">Jinja2</a> is strongly "
"recommended."
}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

View File

@ -85,12 +85,12 @@ class ObjectChangeActionChoices(ChoiceSet):
class TemplateLanguageChoices(ChoiceSet):
LANGUAGE_DJANGO = 'django'
LANGUAGE_JINJA2 = 'jinja2'
LANGUAGE_DJANGO = 'django'
CHOICES = (
(LANGUAGE_DJANGO, 'Django'),
(LANGUAGE_JINJA2, 'Jinja2'),
(LANGUAGE_DJANGO, 'Django (Legacy)'),
)