I am wanting to query data using the build in Django functions on postgresql database. When the highlighted line of code runs, I get the following error: django.db.utils.ProgrammingError: can't adapt type 'SimpleLazyObject'. When I change the database settings to the default database, then the query runs with no problems. What is the solution? I want to use the build in Django functions (that is, Entry.objects.dosomething) on postgresql database. How can I do this?
Asked
Active
Viewed 119 times
0

Mohammad Mahjoub
- 417
- 4
- 12
-
I'm really confused by the statement "when I change the database settings to the default database, the query runs". Can you show us what settting you are changing, and what values work/don't work? – Chris Curvey Apr 14 '18 at 10:54
-
This is the updated settings: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'XXXXX', 'USER': 'XXXXX', 'PASSWORD': 'XXXXX', 'HOST': 'XXXXX', 'PORT': '5432', } } When I used the default it worked, but not with the new settings. I was able to fix this problem by using Entry.objects.filter(user=) instead of Entry.objects.filter(user__username__iexact=). Thanks for the help. – Mohammad Mahjoub Apr 15 '18 at 03:36