Post/Redirect/Get-like approach for React + Django AJAX apps
Project description
logicore-django-react-pages
PRG-like approach for React + Django AJAX apps
Use together with: React counterpart
and on top of: Running React and Django on a single port
Usage
-
Assuming your main apps' name is
main
-
Add to
views.py
:
from logicore_django_react_pages.views import ApiView
class HomeView(ApiView):
url_name = "home"
url_path = "/"
WRAPPER = "MainWrapper"
TEMPLATE = "HomeView"
def get_data(self, request, *args, **kwargs):
return {} # some context
- Add to
urls.py
from logicore_django_react.urls import react_reload_and_static_urls, react_html_template_urls
from logicore_django_react_pages.views import all_api_urls
urlpatterns = [
# ...
*all_api_urls(), # in any position
# ...
]
# add static/media endpoints here if needed
# urlpatterns += static(...)
# lastly, combine with logicore_django_react urls
urlpatterns = react_reload_and_static_urls + urlpatterns + react_html_template_urls
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
Close
Hashes for logicore-django-react-pages-1.0.0.dev3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 238b25fae2489857f3b5b6d729efb8c449d7b28a895983a4f7a2d67317307ac4 |
|
MD5 | c97b8d3a07f7d620087ca0cb302fda3e |
|
BLAKE2b-256 | cc7ef49aa791cc18e564a3ecc10224ad65ec353ef443613ba6d8bb3bbd445d4f |
Close
Hashes for logicore_django_react_pages-1.0.0.dev3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77ee5a21405c0474e8b48ad8b96e9900c18a58acf5e3233fc658af31ae2c93cb |
|
MD5 | 835d5004c14b4f0c748b3f3f32c334e8 |
|
BLAKE2b-256 | 8cbbe00df2e9798b915e65cfd415204eb1c06419a2eb43b54607214e0779a3d0 |