Arnar Tumi Þorsteinsson 8 éve
szülő
commit
87766bffb8
3 módosított fájl, 7 hozzáadás és 1 törlés
  1. 2 0
      bakerydemo/breads/models.py
  2. 3 1
      bakerydemo/settings/base.py
  3. 2 0
      bakerydemo/urls.py

+ 2 - 0
bakerydemo/breads/models.py

@@ -93,6 +93,8 @@ class BreadPage(Page):
        'BreadsIndexPage'
     ]
 
+    api_fields = ['title', 'bread_type', 'origin', 'image']
+
 
 class BreadsIndexPage(Page):
     '''

+ 3 - 1
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',

+ 2 - 0
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)),
 
 ]