Metadata-Version: 2.1
Name: djspa
Version: 1.0.1
Summary: Django addon for a single page application with dynamically loaded pages
Home-page: https://git.voltane.eu/voltane/pypi/djspa
Author: Manuel Stingl
Author-email: opensource@voltane.eu
License: GNU GPLv3
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Operating System :: OS Independent
Classifier: Framework :: Django
Classifier: Framework :: Django :: 2.0
Classifier: Framework :: Django :: 2.1
Classifier: Framework :: Django :: 2.2
Classifier: Framework :: Django :: 3.0
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: django (>=2.0)

# djspa
Django addon for a single page application with dynamically loaded pages

## Installation
Use the python package manager pip to install djutils.

```bash
pip install djspa
```

## Usage
Add 'djspa' to INSTALLED_APPS at the end
```python
INSTALLED_APPS = [
    ...
    'djspa',
]
```

Mark your BasePage (Template Class from that all other templates inherit) with the
@set_baseview decorator of djspa

```python
from django.views import generic
from djspa import set_baseview

@set_baseview
class BaseView(generic.TemplateView):
    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['my_global_template_variable'] = 42
        return context
```

Define your dynamic pages by a class, which inherits from your BaseView and the PageMixin.
You have to set at least the `name` property, which is the name of the template and also the url.

Import the djspa urlpatterns after you defined all views
`from djspa.urls import urlpatterns # pylint:disable=C0411; urlpatterns of djspa MUST be loaded after all view definitions`

You have to define at least the index page, otherwise you get an endless redirect loop.
```python
from djspa import PageMixin

class Index(BaseView, PageMixin):
    name = 'index'
```

Include the pages snippet in your index page template
```
{% include 'djspa_pages.html' %}
```

## License
GNU GPLv3, see LICENSE

## Maintainer
This package is maintained by Manuel Stingl.
For more information see https://opensource.voltane.eu


