Просмотр исходного кода

Mark the whole queryset block for removal, note the deprecation in the feature overview

Jason Novinger 2 дней назад
Родитель
Сommit
7cbacae3cf
2 измененных файлов с 4 добавлено и 1 удалено
  1. 3 0
      docs/features/customization.md
  2. 1 1
      netbox/extras/models/models.py

+ 3 - 0
docs/features/customization.md

@@ -63,6 +63,9 @@ To learn more about this feature, check out the [custom validation documentation
 
 ## Export Templates
 
+!!! warning "Deprecation Warning"
+    The `queryset` variable and the model classes available in export templates have been deprecated as of NetBox v4.8.0, and are scheduled for removal in NetBox v5.0. See the [export template documentation](../customization/export-templates.md) for details.
+
 Most NetBox objects can be exported in bulk in two built-in CSV formats: The current view (what the user currently sees in the objects list), or all available data. NetBox also provides the capability to define your own custom data export formats via export templates. An export template is essentially [Jinja2](https://jinja.palletsprojects.com/) template code associated with a particular object type. From the objects list in the NetBox UI, a user can select any of the created export templates to export the objects according to the template logic.
 
 An export template doesn't have to render CSV data: Its output can be in any character-based format. For example, you might want to render data using tabs as delimiters, or even create DNS address records directly from the IP addresses list. Export templates are a great way to get the data you need in the format you need quickly.

+ 1 - 1
netbox/extras/models/models.py

@@ -574,10 +574,10 @@ class ExportTemplate(
 
     def get_context(self, context=None, queryset=None):
         _context = super().get_context(context=context, queryset=queryset)
+        # TODO: Remove in NetBox v5.0 along with this override
         # Fetch each related object the template reads for the whole queryset at once
         if queryset is not None:
             queryset = queryset.fetch_mode(FETCH_PEERS)
-        # TODO: Remove in NetBox v5.0
         _context['queryset'] = queryset
         return _context