99👍
✅
You can not pass directly str
as a django response
.
You must use
from django.http import HttpResponse
if you want to render string data as django view response.
have a look django.http.HttpResponse
return HttpResponse(resp)
6👍
Django views must always return an HttpResponse
object, so try wrapping that string in an HttpResponse:
from django.http import HttpResponse
return HttpResponse(str(resp))
Additionally, the number
variable in generate_xml
will contain only the string 'number'
, not the GET parameter. To get that, you might use:
request.GET.get('id')
- [Django]-Django composite unique on multiple model fields
- [Django]-How do I use allow_tags in django 2.0 admin?
- [Django]-Strange PostgreSQL "value too long for type character varying(500)"
Source:stackexchange.com