Skip to content
This repository was archived by the owner on Dec 11, 2024. It is now read-only.

Commit dc2a720

Browse files
authored
Merge pull request #11 from kristofgilicze/fixing-readme-snippet-highlighting
Fixing readme snippet highlighting
2 parents e070cf2 + 693f467 commit dc2a720

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

README.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@
22
![Python package](https://github.com/zodman/inertia-django/workflows/Python%20package/badge.svg)
33
[![Coverage Status](https://coveralls.io/repos/github/zodman/inertia-django/badge.svg?branch=master)](https://coveralls.io/github/zodman/inertia-django?branch=master)
44

5-
Based on inertia-laravel.
5+
### TL;DR:
66

7-
Check https://github.com/zodman/django-inertia-demo for example how to use
7+
`inertia-django` connetor gives you the ability to replace 'classic' templates with **Vue / React / Svelte** components.
8+
- SPA user experience with MPA style development flow.
9+
- No need for clientside routing, just use `urls.py`.
10+
- No need for API endpoints, just pass data directly to the props of the client-side component.
11+
12+
based on inertia-laravel.
13+
14+
#### demo project available in this repo: https://github.com/zodman/django-inertia-demo
15+
#### more on inertia: https://inertiajs.com
816

917

1018
## Usage
@@ -19,7 +27,12 @@ from inertia import render_inertia
1927

2028
def index(request):
2129
# for function views just use the render_inertia function
22-
return render_inertia(request, 'Index', props={'title': 'My inertia-django page'}, template_name='index.html')
30+
return render_inertia(
31+
request,
32+
'Index',
33+
props={'title': 'My inertia-django page'},
34+
template_name='index.html'
35+
)
2336
```
2437

2538
----
@@ -32,7 +45,7 @@ def index(request):
3245

3346
### Root Template
3447

35-
```html=
48+
```html+django
3649
{# templates/base.html #}
3750
{% load js_routes_tags %}<!DOCTYPE html>
3851
<html class="h-full bg-gray-200">
@@ -54,7 +67,7 @@ def index(request):
5467

5568
### Creating responses
5669

57-
```python=
70+
```python
5871
from inertia.views import render_inertia
5972

6073
def event_detail(request, id):
@@ -70,21 +83,21 @@ def event_detail(request, id):
7083
return render_inertia(request, "Event/Show", props)
7184
```
7285

73-
We strong suggest to use [marshmallow](https://marshmallow.readthedocs.io/en/latest/)
74-
because it had serializer and validation and fully compatible with django.
86+
We strongly recommend to use [marshmallow](https://marshmallow.readthedocs.io/en/latest/)
87+
since it has a serializer, validation and fully compatible with django.
7588

7689

7790
## Client-side setup
7891
### Install dependencies
79-
```
92+
```bash
8093
npm install @inertiajs/inertia @inertiajs/inertia-vue
8194
# extra deps
8295
npm install parcel-bundler
8396
```
8497

8598
### Initialize app
8699

87-
```javascript=
100+
```javascript
88101
import { InertiaApp } from '@inertiajs/inertia-vue'
89102
import Vue from 'vue'
90103
Vue.use(InertiaApp);
@@ -132,5 +145,3 @@ For the part of the urls the same functionality as laravel or ziggy is
132145

133146
# TODO: explain how inertia/middleware.py works
134147

135-
# more info https://inertiajs.com/
136-

0 commit comments

Comments
 (0)