-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comptability with Wagtail 2? #8
Comments
Hi @alanmoo, thanks very much for opening this issue. Encouragement like this helps motivate us to add that support. We have a similar open issue on one of our other projects, wagtail-sharing. I'll take a look and see what might be involved in adding support here. |
It looks like cfpb/wagtail-sharing#22 has been addressed, is it likely that this project just needs a similar treatment? |
Closed
chosak
added a commit
to chosak/wagtail-inventory
that referenced
this issue
Jun 11, 2018
This change adds support for Django 2.0 and Wagtail 2.0/2.1 to this package. The README has been updated to reflect the change. A `.coveragerc` file has been added to more helpfully limit test code coverage and the test runner now dumps coverage to console for easier reviewing. These changes also include a new test fixture for easier testing of blocks. Fixes cfpb#8. To verify this change against Django 2.0 and Wagtail 2.0: 1. Create a new isolated virtualenv with Python 3.6 named `testwi`. ``` $ mkvirtualenv --no-site-packages --python=python3.6 testwi ``` 2. Install this PR into the virtualenv. Pulls in Wagtail/Django 2. This open issue (python-pillow/Pillow#3068) means that at least for now on Macs, you need to override the version of Pillow that gets pulled in from those. ```sh $ pip install git+https://github.com/chosak/wagtail-inventory.git@wagtail-django-2 $ pip install Pillow!=5.1.0 ``` 3. Create a new Wagtail project named `myproject`. ```sh $ wagtail start myproject $ cd myproject ``` 4. Edit project settings to add modeladmin, the wagtail-inventory app and its test app, along with Wagtail modeladmin, for access to a test page class and block types. ```sh diff --git a/myproject/settings/base.py b/myproject/settings/base.py index fe5d391..7e8c232 100644 --- a/myproject/settings/base.py +++ b/myproject/settings/base.py @@ -48,6 +48,8 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + + 'wagtail.contrib.modeladmin', + 'wagtailinventory', + 'wagtailinventory.tests.testapp', ] MIDDLEWARE = [ ``` 5. Create a database and a superuser. ```sh $ ./manage.py migrate $ ./manage.py createsuperuser ``` 6. Run the `block_inventory` command to initialize the block table. ```sh $ ./manage.py block_inventory ``` 7. Run your local server. ```sh $ ./manage.py runserver ``` 9. Login to the admin at http://localhost:8000/admin/ with the superuser you just created. Under Settings, Block Inventory you should see the two default Wagtail pages. You shouldn't see any options in the dropdown because the default pages don't include StreamField blocks. 10. Now we'll add a new page that does include StreamField blocks. In the sidebar, click Pages, Home. Click the Add Child Page button and choose one of the test page types, say "Multiple stream fields page". Add some StreamField content, then click Save Draft. 11. If you go back to Settings, Block Inventory, you'll see that the dropdown menus now include the block types that you included. Play around with adding/deleting content from the page to see how the inventory results change. Results should automatically be updated whenever the page is saved. Thanks to @alanmoo for contributing to these changes.
chosak
added a commit
to chosak/wagtail-inventory
that referenced
this issue
Jun 11, 2018
This change adds support for Django 2.0 and Wagtail 2.0/2.1 to this package. The README has been updated to reflect the change. A `.coveragerc` file has been added to more helpfully limit test code coverage and the test runner now dumps coverage to console for easier reviewing. These changes also include a new test fixture for easier testing of blocks. Fixes cfpb#8. To verify this change against Django 2.0 and Wagtail 2.0: 1. Create a new isolated virtualenv with Python 3.6 named `testwi`. ``` $ mkvirtualenv --no-site-packages --python=python3.6 testwi ``` 2. Install this PR into the virtualenv. Pulls in Wagtail/Django 2. This open issue (python-pillow/Pillow#3068) means that at least for now on Macs, you need to override the version of Pillow that gets pulled in from those. ```sh $ pip install git+https://github.com/chosak/wagtail-inventory.git@wagtail-django-2 $ pip install Pillow!=5.1.0 ``` 3. Create a new Wagtail project named `myproject`. ```sh $ wagtail start myproject $ cd myproject ``` 4. Edit project settings to add modeladmin, the wagtail-inventory app and its test app, along with Wagtail modeladmin, for access to a test page class and block types. ```sh diff --git a/myproject/settings/base.py b/myproject/settings/base.py index fe5d391..7e8c232 100644 --- a/myproject/settings/base.py +++ b/myproject/settings/base.py @@ -48,6 +48,8 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + + 'wagtail.contrib.modeladmin', + 'wagtailinventory', + 'wagtailinventory.tests.testapp', ] MIDDLEWARE = [ ``` 5. Create a database and a superuser. ```sh $ ./manage.py migrate $ ./manage.py createsuperuser ``` 6. Run the `block_inventory` command to initialize the block table. ```sh $ ./manage.py block_inventory ``` 7. Run your local server. ```sh $ ./manage.py runserver ``` 9. Login to the admin at http://localhost:8000/admin/ with the superuser you just created. Under Settings, Block Inventory you should see the two default Wagtail pages. You shouldn't see any options in the dropdown because the default pages don't include StreamField blocks. 10. Now we'll add a new page that does include StreamField blocks. In the sidebar, click Pages, Home. Click the Add Child Page button and choose one of the test page types, say "Multiple stream fields page". Add some StreamField content, then click Save Draft. 11. If you go back to Settings, Block Inventory, you'll see that the dropdown menus now include the block types that you included. Play around with adding/deleting content from the page to see how the inventory results change. Results should automatically be updated whenever the page is saved. Thanks to @alanmoo for contributing to these changes.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @chosak, any plans to make this compatible with Wagtail 2? Or any guidance on what might need updating in order to submit a PR for Wagtail 2 compatibility?
The text was updated successfully, but these errors were encountered: