{"repo":"paqstd-dev/django-suspense","free":true,"listed":false,"github":"https://github.com/paqstd-dev/django-suspense","clone":"git clone https://github.com/paqstd-dev/django-suspense.git","description":"Easy way to display a fallback in templates until children have finished loading.","language":"Python","stars":17,"topics":["django","suspense","template","hacktoberfest"],"license":"MIT","category":"saas-starters-boilerplates","readme_excerpt":"Django Suspense Django Suspense is small package to easily display a fallback in templates until children have finished loading. Quick start 1. Install package: To get started, install the package from pypi: Now you can add suspense to your django project. Change your INSTALLED APPS setting like this: Optionally, you can specify suspense as builtins and this will be available in any of your templates without additionally specifying {% load suspense %} : If you choose not use it as a built-in, you will need to add {% load suspense %} to the top of your template whenever you want to use suspense. 2. Create view with slow lazy load object: Because django executes database queries lazily, they may sometimes not work as expected. Let's try to create a very slow but lazy object and write a view function: 3. Use suspense in your template: Let's now add the output of the received data to the template. At this point, we still haven't made a database query, so we can easily and quickly show the template right away. Once obj is ready for use, we will show it. But until it is ready, fallback works. While we are waiting for the data to be displayed, a request is made on the client side. Suspense does not add additional DOM elements after rendering the final result. That's why syntactically the code above will be valid. 4. Hooray! Everything is ready to use it. Troubleshooting Safari delay in rendering On Safari if your webpage is very light/simple, you may experience a delay in rendering.","default_branch":null,"files":null,"tree":[],"storefront":"/r/paqstd-dev","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/paqstd-dev/django-suspense/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}