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
+25-9
Original file line number
Diff line number
Diff line change
@@ -36,22 +36,38 @@ Using the following categories, list your changes in this order:
36
36
37
37
### Added
38
38
39
-
- ReactPy components can now use SEO compatible rendering!
40
-
-`settings.py:REACTPY_PRERENDER` can be set to `True` to enable this behavior by default
41
-
- Or, you can enable it on individual components via the template tag: `{% component "..." prerender="True" %}`
42
-
-`reactpy_django.components.view_to_iframe` component has been added, which uses an `<iframe>` to render a Django view.
43
-
-`reactpy_django.utils.register_iframe` function has been added, which is mandatory to use alongside `reactpy_django.components.view_to_iframe`.
39
+
- SEO compatible rendering!
40
+
-`settings.py:REACTPY_PRERENDER` can be set to `True` to make components pre-render by default.
41
+
- Or, you can enable it on individual components via the template tag: `{% component "..." prerender="True" %}`.
42
+
- New `view_to_iframe` feature!
43
+
-`reactpy_django.components.view_to_iframe` uses an `<iframe>` to render a Django view.
44
+
-`reactpy_django.utils.register_iframe` tells ReactPy which views `view_to_iframe` can use.
45
+
- New Django `User` related features!
46
+
-`reactpy_django.hooks.use_user` can be used to access the current user.
47
+
-`reactpy_django.hooks.use_user_data` provides a simplified interface for storing user key-value data.
48
+
-`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.
49
+
-`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/).
44
50
45
51
### Changed
46
52
47
-
- Renamed undocumented utility function `reactpy_django.utils.ComponentPreloader` to `reactpy_django.utils.RootComponentFinder`.
53
+
- Renamed undocumented utility function `ComponentPreloader` to `RootComponentFinder`.
48
54
- It is now recommended to call `as_view()` when using `view_to_component` or `view_to_iframe` with Class Based Views.
49
-
- Thread sensitivity has been enabled in all locations where ORM queries are possible.
55
+
- For thread safety, `thread_sensitive=True` has been enabled in all `sync_to_async` functions where ORM queries are possible.
56
+
-`reactpy_django.hooks.use_mutation` now has a `__call__` method. So rather than writing `my_mutation.execute(...)`, you can now write `my_mutation(...)`.
50
57
51
58
### Deprecated
52
59
53
-
- The `compatibility` argument on `reactpy_django.components.view_to_component` is deprecated. Use `reactpy_django.components.view_to_iframe` instead.
54
-
- Using `reactpy_django.components.view_to_component` as a decorator is deprecated. Check the docs on the new suggested usage.
60
+
- The `compatibility` argument on `reactpy_django.components.view_to_component` is deprecated.
61
+
- Use `view_to_iframe` as a replacement.
62
+
-`reactpy_django.components.view_to_component`**usage as a decorator** is deprecated.
63
+
- Check the docs on how to use `view_to_component` as a function instead.
64
+
-`reactpy_django.decorators.auth_required` is deprecated.
65
+
- Use `reactpy_django.decorators.user_passes_test` instead.
66
+
- An equivalent to `auth_required`'s default is `@user_passes_test(lambda user: user.is_active)`.
67
+
68
+
### Fixed
69
+
70
+
- Fixed a bug where exception stacks would not print on failed component renders.
Copy file name to clipboardExpand all lines: docs/src/learn/add-reactpy-to-a-django-project.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -77,15 +77,15 @@ Register ReactPy's WebSocket using `#!python REACTPY_WEBSOCKET_ROUTE` in your [`
77
77
{% include "../../python/configure-asgi.py" %}
78
78
```
79
79
80
-
??? info "Add `#!python AuthMiddlewareStack`and `#!python SessionMiddlewareStack`(Optional)"
80
+
??? info "Add `#!python AuthMiddlewareStack` (Optional)"
81
81
82
82
There are many situations where you need to access the Django `#!python User` or `#!python Session` objects within ReactPy components. For example, if you want to:
83
83
84
84
1. Access the `#!python User` that is currently logged in
85
-
2. Login or logout the current `#!python User`
86
85
3. Access Django's `#!python Session` object
86
+
2. Login or logout the current `#!python User`
87
87
88
-
In these situations will need to ensure you are using `#!python AuthMiddlewareStack` and/or `#!python SessionMiddlewareStack`.
88
+
In these situations will need to ensure you are using `#!python AuthMiddlewareStack`.
89
89
90
90
```python linenums="0"
91
91
{% include "../../python/configure-asgi-middleware.py" start="# start" %}
0 commit comments