Thank you, your response led me towards the correct answer.  return 
JsonResponse(serializer.generatepica(),safe=False).
unfortunately it didn't recognize Response(serializer.generatepica().  I 
probably am missing the correct import.

On Wednesday, August 22, 2018 at 11:57:00 PM UTC-7, Oleg Nykolyn wrote:
>
> Hi,
>
> You should return 
> `rest_framework.response.Response(serializer.generatepica())` 
> instead of `serializer.generatepica()`
>
> ---
> Best regards,
> Oleg
>
> On Thu, Aug 23, 2018 at 9:22 AM aramis1212 via Django REST framework <
> django-res...@googlegroups.com <javascript:>> wrote:
>
>> any idea how to resolve this error message?
>>
>> ia m running this htttpie : http GET 
>> http://127.0.0.1:8000/picamaintenance/createapi/
>>
>> My serializer looks like this: 
>>
>> class addpermissionSerializer(serializers.Serializer):
>>   
>>     def generatepica(request):
>>         cursor = connection.cursor()
>>         cursor.callproc('AddPICA')
>>         result_set = cursor.fetchall()
>>         cursor.close()
>>         sometext = result_set[0][0]
>>         print(sometext)
>>         return sometext
>>
>> my view looks like this:
>>  
>> @csrf_exempt
>> def genpica(request):
>>     """
>>     get a pica
>>     """
>>     if request.method == 'GET':
>>         serializer = addpermissionSerializer()
>>         return (serializer.generatepica())
>>
>> my url looks like this:
>> path('createapi/', views.genpica, name='permission_create_api'),
>>
>> full error message looks like this:
>> 2421
>> Internal Server Error: /picamaintenance/createapi/
>> Traceback (most recent call last):
>>   File 
>> "C:\Bitnami\djangostack-2.0.7-0\apps\django\django-2.0.7-py3.6.egg\django\core\handlers\exception.py",
>>  
>> line 35, in inner
>>     response = get_response(request)
>>   File 
>> "C:\Bitnami\djangostack-2.0.7-0\apps\django\django-2.0.7-py3.6.egg\django\utils\deprecation.py",
>>  
>> line 97, in __call__
>>     response = self.process_response(request, response)
>>   File 
>> "C:\Bitnami\djangostack-2.0.7-0\apps\django\django-2.0.7-py3.6.egg\django\middleware\clickjacking.py",
>>  
>> line 26, in process_response
>>     if response.get('X-Frame-Options') is not None:
>> AttributeError: 'int' object has no attribute 'get'
>> [22/Aug/2018 22:20:32] "GET /picamaintenance/createapi/ HTTP/1.1" 500 
>> 59074
>>
>> currently stuck on this one
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django REST framework" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-rest-framework+unsubscr...@googlegroups.com <javascript:>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to