Ejemplo n.º 1
0
def create(request):
    result = True
    try:
        TaskService.create_task(request)
    except Exception as ex:
        result = Task.task_save_fail
        SimpleLogger.exception(ex)
    return HttpResponse(result)
Ejemplo n.º 2
0
 def post(self, request, *args, **kwargs):
     form_data = request.POST.get('models', None)
     if form_data == None:
         validate_data = request.data
     else:
         json_decoder = JSONDecoder()
         validate_data = json_decoder.decode(form_data)
     task = TaskService.create_task(validate_data, request.user)
     serializer = project_serializer.ProjectTaskSerializer(instance=task)
     headers = self.get_success_headers(serializer.data)
     return response.Response(serializer.data,
                              status=status.HTTP_201_CREATED,
                              headers=headers)
Ejemplo n.º 3
0
 def create(self, validated_data, user):
     task = TaskService.create_task(validated_data, user)
     return task