Gift Genius allows users to quickly make the best-informed decision when purchasing gift cards. Options include a wide selection of gift cards from different retailers and brands, gift card customization, and digital or physical card delivery options.
Login to Site, go to Gift Cards page (/giftcards/), under Sort By drop box, select either Price or Availability, and click Search - raises the following exception:
AttributeError at /giftcards/
'list' object has no attribute 'order_by'
Request Method: GET
Request URL: http://localhost:8000/giftcards/?search=&min_amount=&max_amount=&sort=price
Django Version: 5.1.3
Exception Type: AttributeError
Exception Value:
'list' object has no attribute 'order_by'
Exception Location: C:\Working\GitHub\GiftGenius\giftcards\services.py, line 29, in sort_results
Raised during: giftcards.views.giftcard_list
Python Executable: C:\Working\GitHub\GiftGenius\.venv\Scripts\python.exe
Python Version: 3.12.7
Python Path:
['C:\\Working\\GitHub\\GiftGenius',
'C:\\Program Files\\Python312\\python312.zip',
'C:\\Program Files\\Python312\\DLLs',
'C:\\Program Files\\Python312\\Lib',
'C:\\Program Files\\Python312',
'C:\\Working\\GitHub\\GiftGenius\\.venv',
'C:\\Working\\GitHub\\GiftGenius\\.venv\\Lib\\site-packages']
Server time: Tue, 19 Nov 2024 12:00:25 -0500
Complete Traceback:
Environment:
Request Method: GET
Request URL: http://localhost:8000/giftcards/?search=&min_amount=&max_amount=&sort=price
Django Version: 5.1.3
Python Version: 3.12.7
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'crispy_forms',
'crispy_tailwind',
'accounts.apps.AccountsConfig',
'main',
'giftcards',
'shop.apps.ShopConfig']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback (most recent call last):
File "C:\Working\GitHub\GiftGenius\.venv\Lib\site-packages\django\core\handlers\exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Working\GitHub\GiftGenius\.venv\Lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Working\GitHub\GiftGenius\.venv\Lib\site-packages\django\contrib\auth\decorators.py", line 60, in _view_wrapper
return view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Working\GitHub\GiftGenius\giftcards\views.py", line 23, in giftcard_list
giftcards = search_engine.sort_results(sort_criteria)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Working\GitHub\GiftGenius\giftcards\services.py", line 29, in sort_results
return self.search_results.order_by("amount")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Exception Type: AttributeError at /giftcards/
Exception Value: 'list' object has no attribute 'order_by'
Login to Site, go to Gift Cards page (/giftcards/), under Sort By drop box, select either Price or Availability, and click Search - raises the following exception:
Complete Traceback: