A small, rudimentary helper app for RiotJS integration into django projects.
Project description
A small, rudimentary helper app for RiotJS (https://riot.js.org) integration into django projects.
Quickstart
Install Django RiotJS Helper:
pip install django-riotjs-helper
Add it to your INSTALLED_APPS:
INSTALLED_APPS = (
...
'riotjs_helper',
...
)
Add this to your base template (base.html):
{% include 'riotjs_helper/riotjs_core.html' %}
{% block riot_tags %}
{% endblock riot_tags %}
{% include 'riotjs_helper/riotjs_mount.html' %}
If you plan on using django rest framework you can switch riotjs_core.html to the more elaborate riotjs_setup.html:
{% include 'riotjs_helper/riotjs_setup.html' %}
This setup requires some additional libraries as well, allready included in the requirements.txt:
djangorestframework
django-filter
django-rest-swagger
httpie
Markdown
python-dateutil
coreapi
coreapi-cli
coreschema
And these has to be added to your INSTALLED_APPS, urls has to be updated etc.
And then to create some tags:
python manage.py riot_tag <appname> <tag1-name> <tag2-name>
In the page you want to use your tag:
{% block content %}
...
<tag1-name></tag1-name>
...
<tag2-name></tag2-name>
...
{% endblock %}
{% block riot_tags %}
{% include '<appname>/include/<tag1-name>_tag.html' %}
{% include '<appname>/include/<tag2-name>_tag.html' %}
{% endblock riot_tags %}
If you need to add more context to your tags you can do that by editing the generated include files, for instance like so:
{% load static %}
<script src="{% static '<appname>/tags/<tag1-name>.tag' %}" type="riot/tag"></script>
<script>
riot_context['<tag1-name>'] = {more_context_goes_here: { ... something fancy ...}};
</script>
If you want to look at some boilerplate/example code generate your tags with the –example-code option:
python manage.py riot_tag <appname> <tag1-name> <tag2-name> --example-code
History
0.1.0 (2018-09-23)
First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-riotjs-helper-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08d602a01baac12f6ec8b9c78c16202ecf27cf23d146d545017015e9a1fa86c2 |
|
MD5 | 4b81e12000a4957a643aeb2fd11fdf02 |
|
BLAKE2b-256 | aac0a4f788bbe0348cbcbeb18eb7d246bb73f443101d05bc9eaab0abd4db5252 |
Hashes for django_riotjs_helper-0.1.0-py3.7.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | d83d435063d4ca73778d428e630171781822012f22d2cb29aa83f7da2699e692 |
|
MD5 | 2be0289ac910419fb915400ccda2ad3d |
|
BLAKE2b-256 | 93a54b9d7a7440d8b4a4e461bf37e30756870ce24fde34a06ea8c08dc4426901 |