Closed go0ty closed 9 years ago
Ah. Looks like you might not have a 'map' created.
We should change core.views.py to be something like:
if self.object.job.map:
cv['map'] = self.object.job.map
else:
maps = Map.objects.all()
if maps and len(maps):
cv['map'] = maps[0]
else:
new_default_map = Map(name="Default Map",
description="Default Map that should have the layers you want on most maps") new_default_map.save() cv['map'] = new_default_map
I don't have time to test this now, want to spin on it and see if that works?
--Jay
On Fri, Nov 21, 2014 at 10:27 AM, Patrick D notifications@github.com wrote:
I create a job, then create some test Work Cells underneath that job. Whenever I click on any WorkCells, I receive the following error:
IndexError at /geoq/workcells/work/31
list index out of range Request Method: GET Request URL: http://10.0.3.88:8000/geoq/workcells/work/31 Django Version: 1.5.4 Exception Type: IndexError Exception Value:
list index out of range Exception Location: /usr/local/lib/python2.7/dist-packages/django/db/models/query.py in getitem, line 231 Python Executable: /usr/bin/python Python Version: 2.7.3
Traceback: File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
- response = callback(request, _callback_args, *_callback_kwargs) File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/decorators.py" in _wrapped_view
- return view_func(request, _args, *_kwargs) File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py" in view
- return self.dispatch(request, _args, *_kwargs) File "/home/user/geoq/geoq/core/views.py" in dispatch
- return super(UserAllowedMixin, self).dispatch(request, _args, *_kwargs) File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py" in dispatch
- return handler(request, _args, *_kwargs) File "/usr/local/lib/python2.7/dist-packages/django/views/generic/detail.py" in get
- context = self.get_context_data(object=self.object) File "/home/user/geoq/geoq/core/views.py" in get_context_data
- cv['map'] = Map.objects.all()[0] File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" in getitem
- return list(qs)[0]
Exception Type: IndexError at /geoq/workcells/work/31 Exception Value: list index out of range
— Reply to this email directly or view it on GitHub https://github.com/ngageoint/geoq/issues/279.
This works! Thank you.
I create a job, then create some test Work Cells underneath that job. Whenever I click on any WorkCells, I receive the following error:
IndexError at /geoq/workcells/work/31
list index out of range Request Method: GET Request URL: http://10.0.3.88:8000/geoq/workcells/work/31 Django Version: 1.5.4 Exception Type: IndexError Exception Value:
list index out of range Exception Location: /usr/local/lib/python2.7/dist-packages/django/db/models/query.py in getitem, line 231 Python Executable: /usr/bin/python Python Version: 2.7.3
Traceback: File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
Exception Type: IndexError at /geoq/workcells/work/31 Exception Value: list index out of range