You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -80,8 +80,8 @@ Using the following categories, list your changes in this order:
80
80
- New Django `User` related features!
81
81
-`reactpy_django.hooks.use_user` can be used to access the current user.
82
82
-`reactpy_django.hooks.use_user_data` provides a simplified interface for storing user key-value data.
83
-
-`reactpy_django.decorators.user_passes_test` is inspired by the [equivalent Django decorator](http://docs.djangoproject.com/en/stable/topics/auth/default/#django.contrib.auth.decorators.user_passes_test), but ours works with ReactPy components.
84
-
-`settings.py:REACTPY_AUTO_RELOGIN` will cause component WebSocket connections to automatically [re-login](https://channels.readthedocs.io/en/latest/topics/authentication.html#how-to-log-a-user-in-out) users that are already authenticated. This is useful to continuously update `last_login` timestamps and refresh the [Django login session](https://docs.djangoproject.com/en/stable/topics/http/sessions/).
83
+
-`reactpy_django.decorators.user_passes_test` is inspired by the [equivalent Django decorator](http://docs.djangoproject.com/en/dev/topics/auth/default/#django.contrib.auth.decorators.user_passes_test), but ours works with ReactPy components.
84
+
-`settings.py:REACTPY_AUTO_RELOGIN` will cause component WebSocket connections to automatically [re-login](https://channels.readthedocs.io/en/latest/topics/authentication.html#how-to-log-a-user-in-out) users that are already authenticated. This is useful to continuously update `last_login` timestamps and refresh the [Django login session](https://docs.djangoproject.com/en/dev/topics/http/sessions/).
Copy file name to clipboardExpand all lines: docs/src/learn/add-reactpy-to-a-django-project.md
+7-7
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ If you want to add some interactivity to your existing **Django project**, you d
8
8
9
9
!!! abstract "Note"
10
10
11
-
These docs assumes you have already created [a **Django project**](https://docs.djangoproject.com/en/stable/intro/tutorial01/), which involves creating and installing at least one **Django app**.
11
+
These docs assumes you have already created [a **Django project**](https://docs.djangoproject.com/en/dev/intro/tutorial01/), which involves creating and installing at least one **Django app**.
12
12
13
13
If do not have a **Django project**, check out this [9 minute YouTube tutorial](https://www.youtube.com/watch?v=ZsJRXS_vrw0) created by _IDG TECHtalk_.
14
14
@@ -24,7 +24,7 @@ pip install reactpy-django
24
24
25
25
## Step 2: Configure `settings.py`
26
26
27
-
Add `#!python "reactpy_django"` to [`INSTALLED_APPS`](https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-INSTALLED_APPS) in your [`settings.py`](https://docs.djangoproject.com/en/stable/topics/settings/) file.
27
+
Add `#!python "reactpy_django"` to [`INSTALLED_APPS`](https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-INSTALLED_APPS) in your [`settings.py`](https://docs.djangoproject.com/en/dev/topics/settings/) file.
28
28
29
29
=== "settings.py"
30
30
@@ -36,7 +36,7 @@ Add `#!python "reactpy_django"` to [`INSTALLED_APPS`](https://docs.djangoproject
36
36
37
37
ReactPy-Django requires Django ASGI and [Django Channels](https://github.com/django/channels) WebSockets.
38
38
39
-
If you have not enabled ASGI on your **Django project** yet, here is a summary of the [`django`](https://docs.djangoproject.com/en/stable/howto/deployment/asgi/) and [`channels`](https://channels.readthedocs.io/en/stable/installation.html) installation docs:
39
+
If you have not enabled ASGI on your **Django project** yet, here is a summary of the [`django`](https://docs.djangoproject.com/en/dev/howto/deployment/asgi/) and [`channels`](https://channels.readthedocs.io/en/stable/installation.html) installation docs:
40
40
41
41
1. Install `channels[daphne]`
42
42
2. Add `#!python "daphne"` to `#!python INSTALLED_APPS`.
@@ -59,7 +59,7 @@ Add `#!python "reactpy_django"` to [`INSTALLED_APPS`](https://docs.djangoproject
59
59
60
60
## Step 3: Configure `urls.py`
61
61
62
-
Add ReactPy HTTP paths to your `#!python urlpatterns` in your [`urls.py`](https://docs.djangoproject.com/en/stable/topics/http/urls/) file.
62
+
Add ReactPy HTTP paths to your `#!python urlpatterns` in your [`urls.py`](https://docs.djangoproject.com/en/dev/topics/http/urls/) file.
63
63
64
64
=== "urls.py"
65
65
@@ -69,7 +69,7 @@ Add ReactPy HTTP paths to your `#!python urlpatterns` in your [`urls.py`](https:
69
69
70
70
## Step 4: Configure `asgi.py`
71
71
72
-
Register ReactPy's WebSocket using `#!python REACTPY_WEBSOCKET_ROUTE` in your [`asgi.py`](https://docs.djangoproject.com/en/stable/howto/deployment/asgi/) file.
72
+
Register ReactPy's WebSocket using `#!python REACTPY_WEBSOCKET_ROUTE` in your [`asgi.py`](https://docs.djangoproject.com/en/dev/howto/deployment/asgi/) file.
73
73
74
74
=== "asgi.py"
75
75
@@ -97,15 +97,15 @@ Register ReactPy's WebSocket using `#!python REACTPY_WEBSOCKET_ROUTE` in your [`
97
97
98
98
## Step 5: Run database migrations
99
99
100
-
Run Django's [`migrate` command](https://docs.djangoproject.com/en/stable/topics/migrations/) to initialize ReactPy-Django's database table.
100
+
Run Django's [`migrate` command](https://docs.djangoproject.com/en/dev/topics/migrations/) to initialize ReactPy-Django's database table.
101
101
102
102
```bash linenums="0"
103
103
python manage.py migrate
104
104
```
105
105
106
106
## Step 6: Check your configuration
107
107
108
-
Run Django's [`check` command](https://docs.djangoproject.com/en/stable/ref/django-admin/#check) to verify if ReactPy was set up correctly.
108
+
Run Django's [`check` command](https://docs.djangoproject.com/en/dev/ref/django-admin/#check) to verify if ReactPy was set up correctly.
Copy file name to clipboardExpand all lines: docs/src/learn/your-first-component.md
+6-6
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ You will now need to pick at least one **Django app** to start using ReactPy-Dja
18
18
19
19
For the following examples, we will assume the following:
20
20
21
-
1. You have a **Django app** named `my_app`, which was created by Django's [`startapp` command](https://docs.djangoproject.com/en/stable/intro/tutorial01/#creating-the-polls-app).
21
+
1. You have a **Django app** named `my_app`, which was created by Django's [`startapp` command](https://docs.djangoproject.com/en/dev/intro/tutorial01/#creating-the-polls-app).
22
22
2. You have placed `my_app` directly into your **Django project** folder (`./example_project/my_app`). This is common for small projects.
23
23
24
24
??? question "How do I organize my Django project for ReactPy?"
@@ -72,19 +72,19 @@ Additionally, you can pass in `#!python args` and `#!python kwargs` into your co
72
72
73
73
??? question "Where is my templates folder?"
74
74
75
-
If you do not have a `./templates/` folder in your **Django app**, you can simply create one! Keep in mind, templates within this folder will not be detected by Django unless you [add the corresponding **Django app** to `settings.py:INSTALLED_APPS`](https://docs.djangoproject.com/en/stable/ref/applications/#configuring-applications).
75
+
If you do not have a `./templates/` folder in your **Django app**, you can simply create one! Keep in mind, templates within this folder will not be detected by Django unless you [add the corresponding **Django app** to `settings.py:INSTALLED_APPS`](https://docs.djangoproject.com/en/dev/ref/applications/#configuring-applications).
76
76
77
77
## Setting up a Django view
78
78
79
-
Within your **Django app**'s `views.py` file, you will need to [create a view function](https://docs.djangoproject.com/en/stable/intro/tutorial01/#write-your-first-view) to render the HTML template `my-template.html` ([_from the previous step_](#embedding-in-a-template)).
79
+
Within your **Django app**'s `views.py` file, you will need to [create a view function](https://docs.djangoproject.com/en/dev/intro/tutorial01/#write-your-first-view) to render the HTML template `my-template.html` ([_from the previous step_](#embedding-in-a-template)).
80
80
81
81
=== "views.py"
82
82
83
83
```python
84
84
{% include "../../examples/python/example/views.py" %}
85
85
```
86
86
87
-
We will add this new view into your [`urls.py`](https://docs.djangoproject.com/en/stable/intro/tutorial01/#write-your-first-view) and define what URL it should be accessible at.
87
+
We will add this new view into your [`urls.py`](https://docs.djangoproject.com/en/dev/intro/tutorial01/#write-your-first-view) and define what URL it should be accessible at.
88
88
89
89
=== "urls.py"
90
90
@@ -98,7 +98,7 @@ We will add this new view into your [`urls.py`](https://docs.djangoproject.com/e
98
98
99
99
Once you reach that point, we recommend creating an individual `urls.py` within each of your **Django apps**.
100
100
101
-
Then, within your **Django project's** `urls.py` you will use Django's [`include` function](https://docs.djangoproject.com/en/stable/ref/urls/#include) to link it all together.
101
+
Then, within your **Django project's** `urls.py` you will use Django's [`include` function](https://docs.djangoproject.com/en/dev/ref/urls/#include) to link it all together.
102
102
103
103
## Viewing your component
104
104
@@ -114,7 +114,7 @@ If you copy-pasted our example component, you will now see your component displa
114
114
115
115
??? warning "Do not use `manage.py runserver` for production"
116
116
117
-
This command is only intended for development purposes. For production deployments make sure to read [Django's documentation](https://docs.djangoproject.com/en/stable/howto/deployment/).
117
+
This command is only intended for development purposes. For production deployments make sure to read [Django's documentation](https://docs.djangoproject.com/en/dev/howto/deployment/).
Copy file name to clipboardExpand all lines: docs/src/reference/components.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ Automatically convert a Django view into a component.
14
14
15
15
At this time, this works best with static views with no interactivity.
16
16
17
-
Compatible with sync or async [Function Based Views](https://docs.djangoproject.com/en/stable/topics/http/views/) and [Class Based Views](https://docs.djangoproject.com/en/stable/topics/class-based-views/).
17
+
Compatible with sync or async [Function Based Views](https://docs.djangoproject.com/en/dev/topics/http/views/) and [Class Based Views](https://docs.djangoproject.com/en/dev/topics/class-based-views/).
18
18
19
19
=== "components.py"
20
20
@@ -144,7 +144,7 @@ Automatically convert a Django view into an [`iframe` element](https://www.techt
144
144
145
145
The contents of this `#!python iframe` is handled entirely by traditional Django view rendering. While this solution is compatible with more views than `#!python view_to_component`, it comes with different limitations.
146
146
147
-
Compatible with sync or async [Function Based Views](https://docs.djangoproject.com/en/stable/topics/http/views/) and [Class Based Views](https://docs.djangoproject.com/en/stable/topics/class-based-views/).
147
+
Compatible with sync or async [Function Based Views](https://docs.djangoproject.com/en/dev/topics/http/views/) and [Class Based Views](https://docs.djangoproject.com/en/dev/topics/class-based-views/).
148
148
149
149
=== "components.py"
150
150
@@ -273,7 +273,7 @@ Compatible with sync or async [Function Based Views](https://docs.djangoproject.
273
273
274
274
## Django CSS
275
275
276
-
Allows you to defer loading a CSS stylesheet until a component begins rendering. This stylesheet must be stored within [Django's static files](https://docs.djangoproject.com/en/stable/howto/static-files/).
276
+
Allows you to defer loading a CSS stylesheet until a component begins rendering. This stylesheet must be stored within [Django's static files](https://docs.djangoproject.com/en/dev/howto/static-files/).
277
277
278
278
=== "components.py"
279
279
@@ -326,7 +326,7 @@ Allows you to defer loading a CSS stylesheet until a component begins rendering.
326
326
327
327
## Django JS
328
328
329
-
Allows you to defer loading JavaScript until a component begins rendering. This JavaScript must be stored within [Django's static files](https://docs.djangoproject.com/en/stable/howto/static-files/).
329
+
Allows you to defer loading JavaScript until a component begins rendering. This JavaScript must be stored within [Django's static files](https://docs.djangoproject.com/en/dev/howto/static-files/).
330
330
331
331
<!--
332
332
TODO: This is no longer true since we don't insert elements on the page via JSON Patch anymore.
Copy file name to clipboardExpand all lines: docs/src/reference/decorators.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Decorator functions can be used within your `components.py` to help simplify dev
12
12
13
13
You can limit component access to users that pass a test function by using this decorator.
14
14
15
-
This decorator is inspired by Django's [`user_passes_test`](http://docs.djangoproject.com/en/stable/topics/auth/default/#django.contrib.auth.decorators.user_passes_test) decorator, but works with ReactPy components.
15
+
This decorator is inspired by Django's [`user_passes_test`](http://docs.djangoproject.com/en/dev/topics/auth/default/#django.contrib.auth.decorators.user_passes_test) decorator, but works with ReactPy components.
Whether to run your synchronous query function in thread-sensitive mode. Thread-sensitive mode is turned on by default due to Django ORM limitations. See Django's [`sync_to_async` docs](https://docs.djangoproject.com/en/stable/topics/async/#sync-to-async) docs for more information.
78
+
Whether to run your synchronous query function in thread-sensitive mode. Thread-sensitive mode is turned on by default due to Django ORM limitations. See Django's [`sync_to_async` docs](https://docs.djangoproject.com/en/dev/topics/async/#sync-to-async) docs for more information.
79
79
80
80
This setting only applies to sync query functions, and will be ignored for async functions.
81
81
@@ -132,7 +132,7 @@ Query functions can be sync or async.
132
132
{% include "../../examples/python/use-query-postprocessor-kwargs.py" %}
133
133
```
134
134
135
-
_Note: In Django's ORM design, the field name to access foreign keys is [postfixed with `_set`](https://docs.djangoproject.com/en/stable/topics/db/examples/many_to_one/) by default._
135
+
_Note: In Django's ORM design, the field name to access foreign keys is [postfixed with `_set`](https://docs.djangoproject.com/en/dev/topics/db/examples/many_to_one/) by default._
136
136
137
137
??? question "Can I make ORM calls without hooks?"
138
138
@@ -160,7 +160,7 @@ Query functions can be sync or async.
160
160
161
161
This design decision was based on [Apollo's `#!javascript useQuery` hook](https://www.apollographql.com/docs/react/data/queries/), but ultimately helps avoid Django's `#!python SynchronousOnlyOperation` exceptions.
162
162
163
-
With the `#!python Model` or `#!python QuerySet` your function returns, this hook uses the [default postprocessor](../reference/utils.md#django-query-postprocessor) to ensure that all [deferred](https://docs.djangoproject.com/en/stable/ref/models/instances/#django.db.models.Model.get_deferred_fields) or [lazy](https://docs.djangoproject.com/en/stable/topics/db/queries/#querysets-are-lazy) fields are executed.
163
+
With the `#!python Model` or `#!python QuerySet` your function returns, this hook uses the [default postprocessor](../reference/utils.md#django-query-postprocessor) to ensure that all [deferred](https://docs.djangoproject.com/en/dev/ref/models/instances/#django.db.models.Model.get_deferred_fields) or [lazy](https://docs.djangoproject.com/en/dev/topics/db/queries/#querysets-are-lazy) fields are executed.
164
164
165
165
---
166
166
@@ -219,7 +219,7 @@ Mutation functions can be sync or async.
Whether to run your synchronous mutation function in thread-sensitive mode. Thread-sensitive mode is turned on by default due to Django ORM limitations. See Django's [`sync_to_async` docs](https://docs.djangoproject.com/en/stable/topics/async/#sync-to-async) docs for more information.
222
+
Whether to run your synchronous mutation function in thread-sensitive mode. Thread-sensitive mode is turned on by default due to Django ORM limitations. See Django's [`sync_to_async` docs](https://docs.djangoproject.com/en/dev/topics/async/#sync-to-async) docs for more information.
223
223
224
224
This setting only applies to sync query functions, and will be ignored for async functions.
Copy file name to clipboardExpand all lines: docs/src/reference/settings.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,7 @@ Dotted path to the Django authentication backend to use for ReactPy components.
71
71
72
72
Enabling this will cause component WebSocket connections to automatically [re-login](https://channels.readthedocs.io/en/latest/topics/authentication.html#how-to-log-a-user-in-out) users that are already authenticated.
73
73
74
-
This is useful to continuously update `#!python last_login` timestamps and refresh the [Django login session](https://docs.djangoproject.com/en/stable/topics/http/sessions/).
74
+
This is useful to continuously update `#!python last_login` timestamps and refresh the [Django login session](https://docs.djangoproject.com/en/dev/topics/http/sessions/).
75
75
76
76
---
77
77
@@ -105,7 +105,7 @@ If configuring this value, it is mandatory to enable our database router like su
105
105
106
106
Cache used by ReactPy, typically for caching disk operations.
107
107
108
-
We recommend using [`redis`](https://docs.djangoproject.com/en/stable/topics/cache/#redis), [`memcache`](https://docs.djangoproject.com/en/stable/topics/cache/#memcached), or [`local-memory caching`](https://docs.djangoproject.com/en/stable/topics/cache/#local-memory-caching).
108
+
We recommend using [`redis`](https://docs.djangoproject.com/en/dev/topics/cache/#redis), [`memcache`](https://docs.djangoproject.com/en/dev/topics/cache/#memcached), or [`local-memory caching`](https://docs.djangoproject.com/en/dev/topics/cache/#local-memory-caching).
Copy file name to clipboardExpand all lines: docs/src/reference/utils.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ It is mandatory to use this function alongside [`view_to_iframe`](../reference/c
38
38
39
39
??? warning "Only use this within `#!python MyAppConfig.ready()`"
40
40
41
-
You should always call `#!python register_iframe` within a Django [`MyAppConfig.ready()` method](https://docs.djangoproject.com/en/stable/ref/applications/#django.apps.AppConfig.ready). This ensures you will retain multiprocessing compatibility, such as with ASGI web server workers.
41
+
You should always call `#!python register_iframe` within a Django [`MyAppConfig.ready()` method](https://docs.djangoproject.com/en/dev/ref/applications/#django.apps.AppConfig.ready). This ensures you will retain multiprocessing compatibility, such as with ASGI web server workers.
42
42
43
43
---
44
44
@@ -68,7 +68,7 @@ Typically, this function is automatically called on all components contained wit
68
68
69
69
??? warning "Only use this within `#!python MyAppConfig.ready()`"
70
70
71
-
You should always call `#!python register_component` within a Django [`MyAppConfig.ready()` method](https://docs.djangoproject.com/en/stable/ref/applications/#django.apps.AppConfig.ready). This ensures you will retain multiprocessing compatibility, such as with ASGI web server workers.
71
+
You should always call `#!python register_component` within a Django [`MyAppConfig.ready()` method](https://docs.djangoproject.com/en/dev/ref/applications/#django.apps.AppConfig.ready). This ensures you will retain multiprocessing compatibility, such as with ASGI web server workers.
72
72
73
73
??? question "Do I need to use this?"
74
74
@@ -84,7 +84,7 @@ Typically, this function is automatically called on all components contained wit
84
84
85
85
This is the default postprocessor for the `#!python use_query` hook.
86
86
87
-
Since ReactPy is rendered within an `#!python asyncio` loop, this postprocessor is exists to prevent Django's `#!python SynchronousOnlyException` by recursively prefetching fields within a `#!python Model` or `#!python QuerySet`. This prefetching step works to eliminate Django's [lazy execution](https://docs.djangoproject.com/en/stable/topics/db/queries/#querysets-are-lazy) behavior.
87
+
Since ReactPy is rendered within an `#!python asyncio` loop, this postprocessor is exists to prevent Django's `#!python SynchronousOnlyException` by recursively prefetching fields within a `#!python Model` or `#!python QuerySet`. This prefetching step works to eliminate Django's [lazy execution](https://docs.djangoproject.com/en/dev/topics/db/queries/#querysets-are-lazy) behavior.
0 commit comments