Skip to content
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

Add views for rendering a static API #23

Merged
merged 5 commits into from Jan 19, 2018
Merged

Add views for rendering a static API #23

merged 5 commits into from Jan 19, 2018

Conversation

kaedroho
Copy link
Contributor

@kaedroho kaedroho commented Jan 12, 2018

This implements three new views for rendering pages to static JSON files
using Wagtail's API module:

  • PagesAPIDetailView renders detail pages at /api/pages/detail/{id}.json
  • PagesAPIListingView renders a full page listing at /api/pages/{page_num}.json. Each page contains 20 results.
  • TypedPagesAPIListingView renders a separate listing for each page type at /api/pages/{app_label}.{model_name}/{page_num}.json. Unlike the standard listing view, this also includes all specific fields on that page type.

All rendering is done through Wagtail's v2 API module so any configuration the site has for that will be used by this static renderer.

This implements three new views for rendering pages to static JSON files
using Wagtail's API module:

- ``PagesAPIDetailView`` renders detail pages at
``/api/pages/detail/{id}.json``
- ``PagesAPIListingView`` renders a full page listing at
``/api/pages/{page_num}.json``. Each page contains 20 results.
- ``TypedPagesAPIListingView`` renders a separate listing for each page
type at ``/api/pages/{app_label}.{model_name}/{page_num}.json``. Unlike
the standard listing view, this also includes all specific fields on that
page type.

All rendering is done through Wagtail's v2 API module so any
configuration the site has for that will be used by this static
renderer.
@coveralls
Copy link

coveralls commented Jan 12, 2018

Coverage Status

Coverage decreased (-43.5%) to 44.601% when pulling 49bda1e on kaedroho:api into 8ab6156 on moorinteractive:master.

@robmoorman
Copy link
Collaborator

Great work @kaedroho ! I'll look at this during the weekend, keep you posted!

@tomdyson
Copy link
Contributor

Hi @robmoorman have you had a chance to look at this? Is there anything we can help with?

@tomdyson
Copy link
Contributor

@kaedroho can you please update the Configuration and Usage sections of the README to demonstrate how a developer would use the API view?

@robmoorman
Copy link
Collaborator

He @tomdyson just need to run some extra testing on existing projects, code looks fine (some flake8 minor things though). Should be ready to merge very soon now.

@robmoorman
Copy link
Collaborator

@kaedroho could you provide some tests as well?

@coveralls
Copy link

coveralls commented Jan 18, 2018

Coverage Status

Coverage decreased (-43.5%) to 44.601% when pulling c0cb351 on kaedroho:api into 8ab6156 on moorinteractive:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-14.4%) to 73.709% when pulling e9042ac on kaedroho:api into 8ab6156 on moorinteractive:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-14.4%) to 73.709% when pulling e9042ac on kaedroho:api into 8ab6156 on moorinteractive:master.

@coveralls
Copy link

coveralls commented Jan 18, 2018

Coverage Status

Coverage decreased (-14.4%) to 73.709% when pulling e9042ac on kaedroho:api into 8ab6156 on moorinteractive:master.

@robmoorman
Copy link
Collaborator

Thanks @kaedroho and @tomdyson !

@robmoorman robmoorman merged commit 830401a into wagtail-nest:master Jan 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants