Initial api side implementation of the survey spec

This commit is contained in:
Matthew Jones
2014-09-09 11:08:25 -04:00
parent 9d2fadc51a
commit 514cd4a1db
5 changed files with 484 additions and 1 deletions

View File

@@ -1373,6 +1373,23 @@ class JobTemplateSchedulesList(SubListCreateAPIView):
parent_key = 'unified_job_template'
new_in_148 = True
class JobTemplateSurveySpec(GenericAPIView):
model = JobTemplate
def get(self, request, *args, **kwargs):
obj = self.get_object()
if not obj.survey_enabled:
return Response(status=status.HTTP_404_NOT_FOUND)
return Response(obj.survey_spec)
def post(self, request, *args, **kwargs):
obj = self.get_object()
if not request.user.can_access(self.model, 'change', obj):
raise PermissionDenied()
print request.DATA
return Response()
class JobTemplateActivityStreamList(SubListAPIView):
model = ActivityStream