python - Django server returning different status code -


I am using the Django Framework to implement a simple API. In my view.py I have this method:

  DEF business_profile_detail (request, p): "" "Get, update, or delete a profile." Try "Profile": Profile = BusinessProofile.objects (Status = 404) return HttpResponse if request.method == 'get': (P = P) received BusinessProfile.DoesNotExist except serializer = BusinessProfileSerializer (profile) put back JSONResponse (Serializerkdata) Elif request.method == '': "" "method just is not supported by" "" return response (status = status.HTTP_405_METHOD_NOT_ALLOWED) Elif Requestkmethod == 'delete': "" "" "method not supported yet" return response (status = status.HTTP_405_METHOD_NOT_ALLOWED)  

P>

Edit:

  Traceback: file "/ user / ******* / Documents / dev / offers / project / offers / venv / lib / python2.7 / site-packages / Django-1.7-py2.7.egg / django / core / handlers / base.py "get_response 137. = response.render (in response to) the file" / Users / ** ***** / Documents / dev / offers / project / offers / venv / lib / python2.7 / site-packages / Django-1.7 -py2.7.egg / Django / template / response.py 103. self in " .content = on "/Users/mariopersonal/Documents/dev/offers/project/offers/venv/lib/python2.7 render self.rendered_content file / business / api / profile, / 2 exceptional value AssertionError: /site-packages/rest_framework/response.py "rendered_content 49 loud renderer," .accepted_renderer Response to "Exception type not set .accepted_renderer Response    

It seems that the code you are using is feedback one da logic:

signature: response (data, position = none, template_name = none, header = none, content_type = none)

I'm just a Bunny Adi <'d use code> Actiteepiarpisponse .


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -