44 lines
1.2 KiB
Markdown
44 lines
1.2 KiB
Markdown
---
|
|
title: Report Assets
|
|
---
|
|
|
|
## Report Assets
|
|
|
|
User can upload asset files (e.g. images) which can be used when generating reports. For example, you may wish to generate a report with your company logo in the header. Asset files are uploaded via the admin interface.
|
|
|
|
Asset files can be rendered directly into the template as follows
|
|
|
|
```html
|
|
{% raw %}
|
|
<!-- Need to include the report template tags at the start of the template file -->
|
|
{% load report %}
|
|
|
|
<!-- Simple stylesheet -->
|
|
<head>
|
|
<style>
|
|
.company-logo {
|
|
height: 50px;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<!-- Report template code here -->
|
|
|
|
<!-- Render an uploaded asset image -->
|
|
<img src="{% asset 'company_image.png' %}" class="company-logo">
|
|
|
|
<!-- ... -->
|
|
</body>
|
|
|
|
{% endraw %}
|
|
```
|
|
|
|
!!! warning "Asset Naming"
|
|
If the requested asset name does not match the name of an uploaded asset, the template will continue without loading the image.
|
|
|
|
!!! info "Assets location"
|
|
Upload new assets via the [admin interface](../settings/admin.md) to ensure they are uploaded to the correct location on the server.
|
|
|
|
There are various [helper functions](./helpers.md#report-assets) available to assist with embedding assets into templates.
|