From 87766bffb8e04b9de7314a65d09c76be85dd7a1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnar=20Tumi=20=C3=9Eorsteinsson?= Date: Fri, 10 Feb 2017 14:19:28 +0000 Subject: [PATCH] api --- bakerydemo/breads/models.py | 2 ++ bakerydemo/settings/base.py | 4 +++- bakerydemo/urls.py | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bakerydemo/breads/models.py b/bakerydemo/breads/models.py index 58083a1..4a3b171 100644 --- a/bakerydemo/breads/models.py +++ b/bakerydemo/breads/models.py @@ -93,6 +93,8 @@ class BreadPage(Page): 'BreadsIndexPage' ] + api_fields = ['title', 'bread_type', 'origin', 'image'] + class BreadsIndexPage(Page): ''' diff --git a/bakerydemo/settings/base.py b/bakerydemo/settings/base.py index ba71042..2ec7cc5 100644 --- a/bakerydemo/settings/base.py +++ b/bakerydemo/settings/base.py @@ -50,7 +50,9 @@ INSTALLED_APPS = [ 'wagtail.wagtailadmin', 'wagtail.contrib.modeladmin', 'wagtail.wagtailcore', - + 'wagtail.contrib.wagtailapi', + + 'rest_framework', 'modelcluster', 'taggit', 'wagtailfontawesome', diff --git a/bakerydemo/urls.py b/bakerydemo/urls.py index f8368e2..f9a2445 100644 --- a/bakerydemo/urls.py +++ b/bakerydemo/urls.py @@ -8,6 +8,7 @@ from wagtail.wagtailcore import urls as wagtail_urls from bakerydemo.search import views as search_views +from wagtail.contrib.wagtailapi import urls as wagtailapi_urls urlpatterns = [ url(r'^django-admin/', include(admin.site.urls)), @@ -16,6 +17,7 @@ urlpatterns = [ url(r'^documents/', include(wagtaildocs_urls)), url(r'^search/$', search_views.search, name='search'), + url(r'^api/', include(wagtailapi_urls)), ]