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:
@ -3,7 +3,6 @@ from django.contrib import admin
|
|||||||
|
|
||||||
from utilities.forms import LaxURLField
|
from utilities.forms import LaxURLField
|
||||||
from .models import CustomField, CustomFieldChoice, CustomLink, Graph, ExportTemplate, JobResult, Webhook
|
from .models import CustomField, CustomFieldChoice, CustomLink, Graph, ExportTemplate, JobResult, Webhook
|
||||||
from .reports import get_report
|
|
||||||
|
|
||||||
|
|
||||||
def order_content_types(field):
|
def order_content_types(field):
|
||||||
@ -160,6 +159,10 @@ class GraphForm(forms.ModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Graph
|
model = Graph
|
||||||
exclude = ()
|
exclude = ()
|
||||||
|
help_texts = {
|
||||||
|
'template_language': "<a href=\"https://jinja.palletsprojects.com\">Jinja2</a> is strongly recommended for "
|
||||||
|
"new graphs."
|
||||||
|
}
|
||||||
widgets = {
|
widgets = {
|
||||||
'source': forms.Textarea,
|
'source': forms.Textarea,
|
||||||
'link': forms.Textarea,
|
'link': forms.Textarea,
|
||||||
@ -195,6 +198,11 @@ class ExportTemplateForm(forms.ModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = ExportTemplate
|
model = ExportTemplate
|
||||||
exclude = []
|
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):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
@ -85,12 +85,12 @@ class ObjectChangeActionChoices(ChoiceSet):
|
|||||||
|
|
||||||
class TemplateLanguageChoices(ChoiceSet):
|
class TemplateLanguageChoices(ChoiceSet):
|
||||||
|
|
||||||
LANGUAGE_DJANGO = 'django'
|
|
||||||
LANGUAGE_JINJA2 = 'jinja2'
|
LANGUAGE_JINJA2 = 'jinja2'
|
||||||
|
LANGUAGE_DJANGO = 'django'
|
||||||
|
|
||||||
CHOICES = (
|
CHOICES = (
|
||||||
(LANGUAGE_DJANGO, 'Django'),
|
|
||||||
(LANGUAGE_JINJA2, 'Jinja2'),
|
(LANGUAGE_JINJA2, 'Jinja2'),
|
||||||
|
(LANGUAGE_DJANGO, 'Django (Legacy)'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user