I got an AttributeError: 'WSGIRequest' object has no attribute 'get_raw_uri' when I am trying to update my code from python3.3 to 3.9 and django1.10 to 4.0.8. When I try to call update API I got this error
Related
Trip_router.register(r'places', views.PlaceViewSet, base_name='trips-places')\
.register(r'people', views.PersonInPlaceViewSet, base_name='trips-places-people')
this is my error
Trip_router.register(r'places', views.PlaceViewSet, base_name='trips-places')\
AttributeError: 'NoneType' object has no attribute 'register'
I am using Django 2.0. and package fcm-django==0.2.13
After upgrading to Django 2.0 I have found an error in lib/python3.6/site-packages/fcm_django/api/rest_framework.py it says
'bool' object is not callable at the below line
if user is not None and user.is_authenticated():
I have found the solution at https://github.com/xtrinch/fcm-django/issues/43 and also is_authenticated() raises TypeError TypeError: 'bool' object is not callable
I have to replace is_authenticated() with is_authenticated (without the brackets) in the lib/python3.6/site-packages/fcm_django/api/rest_framework.py file. The latest package fcm-django==0.2.13 is not yet updated with this error.
SO i have edited the file
/home/test/venv/lib/python3.6/site-packages/fcm_django/api/rest_framework.py
Then i save the file.
But when i run the url. It shows the same error in the file rest_framework.py
if user is not None and user.is_authenticated():
but i have changed is_authenticated() to is_aunthenticated
Why django/venv is not reflecting the changes?
In my Django View, I get data from a REST call, which looks like this:
{"id":3,"name":"MySQL","description":"MySQL Database Server - Fedora 21 - medium","image":"","flavor":""}
When I try to pass it as-is to my Form, I get this error:
data = self.form.initial.get(self.name, self.field.initial)
AttributeError: 'unicode' object has no attribute 'get'
What is the proper way to "package" such data for a Form?
That response from REST call it is JSON, you need to convert to a python dict.
import json
data_dict = json.loads(response)[0]
Then you can use your data_dict as normal python dict.
I keep running into this error for both .raw_query and .filter,
it happens when I do a simple query like this :
Tried google but did not have much luck except this .
Is that the same issue? And how do I update the schema to prevent this from happening?
from app.models import Poll
import Datetime
polls = Poll.objects.filter(created_at__gte=datetime.datetime(2013,5,1))
for p in polls:
print p
Error:
AttributeError: 'unicode' object has no attribute 'iteritems'
I keep getting this error when I try to load my templates:
TypeError: cannot concatenate 'str' and 'WSGIRequest' objects
Here is a link to the paste: https://gist.github.com/3b7039baf13d91a67de2
You will notice that one of the lines from the traceback points to my views.py and the last line in the method below. Could this last line be the problem and if so how can I go about fixing it. Thanks in advance
def all(request):
"""This returns all the photos in the database
"""
return render_to_response(request, 'photos/all.html', {'photos':
Photo.objects.all().order_by('-date_added')})
render_to_response doesn't accept request as its first argument.
render, from Django 1.3, however does. Perhaps that the method you intended to use?