palewire / django-calaccess-campaign-browser

A Django app to refine, review and republish campaign finance data drawn from the California Secretary of State’s CAL-ACCESS database
http://django-calaccess-campaign-browser.californiacivicdata.org
MIT License
17 stars 12 forks source link

Some filer detail pages return index errors #101

Closed aboutaaron closed 10 years ago

aboutaaron commented 10 years ago

It's looking there are some mixups on the pk returned throughout the search results

Trace:

Environment:

Request Method: GET
Request URL: http://127.0.0.1:9191/committee/12736/

Django Version: 1.7
Python Version: 2.7.6
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'storages',
 'bakery',
 'calaccess_raw',
 'calaccess_campaign_browser')
Installed Middleware:
('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:
File "/home/aaron/.envs/campaign_finance/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  111.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/aaron/.envs/campaign_finance/local/lib/python2.7/site-packages/django/views/generic/base.py" in view
  69.             return self.dispatch(request, *args, **kwargs)
File "/home/aaron/.envs/campaign_finance/local/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
  87.         return handler(request, *args, **kwargs)
File "/home/aaron/.envs/campaign_finance/local/lib/python2.7/site-packages/django/views/generic/detail.py" in get
  115.         context = self.get_context_data(object=self.object)
File "calaccess_campaign_browser/views/__init__.py" in get_context_data
  91.             self.object,
File "calaccess_campaign_browser/managers.py" in by_committee
  37.             ).order_by("-period__end_date")[0]
File "/home/aaron/.envs/campaign_finance/local/lib/python2.7/site-packages/django/db/models/query.py" in __getitem__
  177.         return list(qs)[0]

Exception Type: IndexError at /committee/12736/
Exception Value: list index out of range