kopia lustrzana https://github.com/wagtail/wagtail
Do not suggest using the custom user model's app config as the custom wagtail.users app config
Doing so would mean the "models" module of the app that contains the
custom user model will be used in favour of the models module of the
wagtail.users app, which contains the UserProfile model. As a result,
the UserProfile model becomes mistakenly picked up by the wagtailcore
app, creating a bogus migration when makemigrations is run.
This partially reverts the docs to the version before
449a48d7f9
, in particular the paragraphs
about creating the custom AppConfig subclass for wagtail.users.
pull/12186/head
rodzic
fa8f9415c9
commit
b757524708
|
@ -107,10 +107,10 @@ class UserViewSet(WagtailUserViewSet):
|
|||
return CustomUserCreationForm
|
||||
```
|
||||
|
||||
Then, configure the `wagtail.users` application to use the custom viewset, by setting up a custom `AppConfig` class. Within your custom `myapp` app directory, create `apps.py` (if it does not exist already) and add:
|
||||
Then, configure the `wagtail.users` application to use the custom viewset, by setting up a custom `AppConfig` class. Within your project folder (which will be the package containing the top-level settings and urls modules), create `apps.py` (if it does not exist already) and add:
|
||||
|
||||
```python
|
||||
# myapp/apps.py
|
||||
# myproject/apps.py
|
||||
from wagtail.users.apps import WagtailUsersAppConfig
|
||||
|
||||
|
||||
|
@ -123,7 +123,8 @@ Replace `wagtail.users` in `settings.INSTALLED_APPS` with the path to `CustomUse
|
|||
```python
|
||||
INSTALLED_APPS = [
|
||||
...,
|
||||
"myapp.apps.CustomUsersAppConfig",
|
||||
"myapp", # an app that contains the custom user model
|
||||
"myproject.apps.CustomUsersAppConfig", # a custom app config for the wagtail.users app
|
||||
# "wagtail.users",
|
||||
...,
|
||||
]
|
||||
|
|
|
@ -89,10 +89,10 @@ Add the field to the group 'edit'/'create' templates:
|
|||
{% endblock extra_fields %}
|
||||
```
|
||||
|
||||
Finally, we configure the `wagtail.users` application to use the custom viewset, by setting up a custom `AppConfig` class. Within your custom `myapp` app directory, create `apps.py` (if it does not exist already) and add:
|
||||
Finally, we configure the `wagtail.users` application to use the custom viewset, by setting up a custom `AppConfig` class. Within your project folder (which will be the package containing the top-level settings and urls modules), create `apps.py` (if it does not exist already) and add:
|
||||
|
||||
```python
|
||||
# myapp/apps.py
|
||||
# myproject/apps.py
|
||||
from wagtail.users.apps import WagtailUsersAppConfig
|
||||
|
||||
|
||||
|
@ -105,7 +105,7 @@ Replace `wagtail.users` in `settings.INSTALLED_APPS` with the path to `CustomUse
|
|||
```python
|
||||
INSTALLED_APPS = [
|
||||
...,
|
||||
"myapp.apps.CustomUsersAppConfig",
|
||||
"myproject.apps.CustomUsersAppConfig",
|
||||
# "wagtail.users",
|
||||
...,
|
||||
]
|
||||
|
|
Ładowanie…
Reference in New Issue