Scott Baker | bf1610d | 2014-06-18 18:22:03 -0700 | [diff] [blame] | 1 | # /opt/planetstack/core/dashboard/views/helloworld.py |
| 2 | import os |
| 3 | import sys |
| 4 | import json |
| 5 | from django.http import HttpResponse, HttpResponseServerError, HttpResponseForbidden |
| 6 | from django.views.generic import TemplateView, View |
| 7 | from core.models import * |
| 8 | from django.forms.models import model_to_dict |
| 9 | |
| 10 | class ShellDataView(View): |
| 11 | url = r'^shelldata/' |
| 12 | |
| 13 | def get(self, request, **kwargs): |
| 14 | allSlices = [] |
| 15 | for slice in Slice.objects.all(): |
| 16 | allSlices.append(model_to_dict(slice)) |
| 17 | |
| 18 | result = {"slices": allSlices} |
| 19 | |
| 20 | return HttpResponse(json.dumps(result), mimetype='application/json') |