Browse Source

Support multiple formats

pull/110/head
Hironsan 5 years ago
parent
commit
0e3597130d
3 changed files with 9 additions and 0 deletions
  1. 5
      app/app/settings.py
  2. 3
      app/server/api_urls.py
  3. 1
      requirements.txt

5
app/app/settings.py

@ -151,6 +151,11 @@ REST_FRAMEWORK = {
'PAGE_SIZE': 5, 'PAGE_SIZE': 5,
'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',), 'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',),
'SEARCH_PARAM': 'q', 'SEARCH_PARAM': 'q',
'DEFAULT_RENDERER_CLASSES': (
'rest_framework.renderers.JSONRenderer',
'rest_framework.renderers.BrowsableAPIRenderer',
'rest_framework_xml.renderers.XMLRenderer'
)
} }
# Internationalization # Internationalization

3
app/server/api_urls.py

@ -1,4 +1,5 @@
from django.urls import path from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from .api import ProjectList, ProjectDetail from .api import ProjectList, ProjectDetail
from .api import LabelList, LabelDetail from .api import LabelList, LabelDetail
@ -25,3 +26,5 @@ urlpatterns = [
path('projects/<int:project_id>/docs/<int:doc_id>/entities/<int:entity_id>', path('projects/<int:project_id>/docs/<int:doc_id>/entities/<int:entity_id>',
EntityDetail.as_view(), name='entity_detail'), EntityDetail.as_view(), name='entity_detail'),
] ]
urlpatterns = format_suffix_patterns(urlpatterns, allowed=['json', 'xml'])

1
requirements.txt

@ -6,6 +6,7 @@ django-heroku==0.3.1
django-widget-tweaks==1.4.2 django-widget-tweaks==1.4.2
djangorestframework==3.8.2 djangorestframework==3.8.2
djangorestframework-filters==0.10.2 djangorestframework-filters==0.10.2
djangorestframework-xml==1.4.0
Faker==0.8.8 Faker==0.8.8
flake8==3.6.0 flake8==3.6.0
gunicorn==19.9.0 gunicorn==19.9.0

Loading…
Cancel
Save