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

Closes #561: Make custom fields accessible from within export templates

This commit is contained in:
Jeremy Stretch
2016-09-19 16:11:37 -04:00
parent d0c92b4f8a
commit b10e29aaac
9 changed files with 45 additions and 11 deletions

View File

@ -35,6 +35,8 @@ Each export template is associated with a certain type of object. For instance,
Export templates are written in [Django's template language](https://docs.djangoproject.com/en/1.9/ref/templates/language/), which is very similar to Jinja2. The list of objects returned from the database is stored in the `queryset` variable. Typically, you'll want to iterate through this list using a for loop.
To access custom fields of an object within a template, use the `cf` attribute. For example, `{{ obj.cf.color }}` will return the value (if any) for a custom field named `color` on `obj`.
A MIME type and file extension can optionally be defined for each export template. The default MIME type is `text/plain`.
## Example