chapeau/django_kepi/views.py

32 wiersze
761 B
Python
Czysty Zwykły widok Historia

from django.shortcuts import render, get_object_or_404
2018-08-11 16:21:56 +00:00
import django.views
from django.http import HttpResponse, JsonResponse
from django.contrib.auth.decorators import login_required
import json
import re
def render(data):
# XXX merge in
result = JsonResponse(
data=data,
json_dumps_params={
'sort_keys': True,
'indent': 2,
}
)
result['Content-Type'] = 'application/activity+json'
return result
2018-08-11 16:21:56 +00:00
class ActivityObjectView(django.views.View):
2018-08-11 16:21:56 +00:00
def get(self, request, *args, **kwargs):
#instance = ActivityObject.objects.get(pk=kwargs['id'])
instance = None # XXX temp
result = instance.serialize()
2018-08-06 13:44:35 +00:00
2018-08-11 16:21:56 +00:00
return render(result)