-
Notifications
You must be signed in to change notification settings - Fork 64
Plugin Templates
It may help to familiarize yourself with Django's templating system. The docs start here: https://docs.djangoproject.com/en/2.0/intro/tutorial03/
If you are already familiar with Jinja2 or some other templating system, you're in luck!
In brief, Sal's templates are html files that are used for the actual output in a web browser. Any time you see curly braces (e.g. {{ hostname }}
or {% if os_family != 'Darwin' %}
, that's a templatetag, a place where Django will replace data from your plugin's context
in the template's html. You can do pretty involved things using for loops and other tags, so please examine the builtin plugins and Django's documentation for more ideas.
By default, without specifying a template path, Sal will look for a template in your plugin's templates folder, with the same name as the python module and a .html
extension. If possible, it's best to use a single template file, unless the complexity of doing so results in heinously ugly and convoluted conditional template code.
If multiple template files are needed, you will need to override the get_template
method of the plugin, which is parameterized with the group_type
and group_id
values to allow you to conditionally select a template.
Sal uses Bootstrap for its CSS framework. bootstrap. Take a look at the builtin plugins' templates to get an idea of how to use Bootstrap to style your plugin.
Sal includes MorrisJS in all templates for easy charting. You can of course use any charting library of your choosing by making sure to add any <script>
includes for that library in your template file.
Other default Javascript includes are jQuery, metisMenu, and DataTables.
To have your plugin include links to the Sal machine_list
view (a DataTable of client machine), construct a URL using the url
templatetag:
<a href="{% url 'machine_list' plugin 'ok' group_type group_id %}">
If you have used the super_get_context
method to create your context object, the plugin
, group_type
, and group_id
values will already be present in the context
.
- Brute force protection
- LDAP integration
- Active Directory integration
- API
- Usage reporting
- License Management
- Maintenance
- Search
- Troubleshooting
- SAML
- IAM Authentication for AWS RDS Postgres
- Docker
- Ubuntu 14.04
- Ubuntu 16.04
- RHEL 7
- Kubernetes
- Heroku?