Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: None #34

Open
Murtrag opened this issue Oct 6, 2021 · 0 comments
Open

KeyError: None #34

Murtrag opened this issue Oct 6, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@Murtrag
Copy link
Owner

Murtrag commented Oct 6, 2021

2021-10-06 08:13:55,065: Internal Server Error: /admin/resume/sectioncontent/
Traceback (most recent call last):
  File "/home/Murtrag/.virtualenvs/resume-virtualenv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/home/Murtrag/.virtualenvs/resume-virtualenv/lib/python3.7/site-packages/django/core/handlers/base.py", line 179, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/Murtrag/.virtualenvs/resume-virtualenv/lib/python3.7/site-packages/django/contrib/admin/options.py", line 614, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)
  File "/home/Murtrag/.virtualenvs/resume-virtualenv/lib/python3.7/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/Murtrag/.virtualenvs/resume-virtualenv/lib/python3.7/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/home/Murtrag/.virtualenvs/resume-virtualenv/lib/python3.7/site-packages/django/contrib/admin/sites.py", line 233, in inner
    return view(request, *args, **kwargs)
  File "/home/Murtrag/.virtualenvs/resume-virtualenv/lib/python3.7/site-packages/django/utils/decorators.py", line 43, in _wrapper
    return bound_method(*args, **kwargs)
  File "/home/Murtrag/.virtualenvs/resume-virtualenv/lib/python3.7/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/Murtrag/.virtualenvs/resume-virtualenv/lib/python3.7/site-packages/django/contrib/admin/options.py", line 1693, in changelist_view
    cl = self.get_changelist_instance(request)
  File "/home/Murtrag/.virtualenvs/resume-virtualenv/lib/python3.7/site-packages/django/contrib/admin/options.py", line 748, in get_changelist_instance
    sortable_by,
  File "/home/Murtrag/.virtualenvs/resume-virtualenv/lib/python3.7/site-packages/django/contrib/admin/views/main.py", line 99, in __init__
    self.queryset = self.get_queryset(request)
  File "/home/Murtrag/.virtualenvs/resume-virtualenv/lib/python3.7/site-packages/django/contrib/admin/views/main.py", line 450, in get_queryset
    ) = self.get_filters(request)
  File "/home/Murtrag/.virtualenvs/resume-virtualenv/lib/python3.7/site-packages/django/contrib/admin/views/main.py", line 137, in get_filters
    spec = list_filter(request, lookup_params, self.model, self.model_admin)
  File "/home/Murtrag/.virtualenvs/resume-virtualenv/lib/python3.7/site-packages/django/contrib/admin/filters.py", line 76, in __init__
    lookup_choices = self.lookups(request, model_admin)
  File "/home/Murtrag/AutoResume/resume/admin.py", line 50, in lookups
    formated = [(x[2], (f'{x[0]} - {LanguageDict[x[1]]}')) for x in list]
  File "/home/Murtrag/AutoResume/resume/admin.py", line 50, in <listcomp>
    formated = [(x[2], (f'{x[0]} - {LanguageDict[x[1]]}')) for x in list]
KeyError: None

Happend when user have None value as language, then this line
formated = [(x[2], (f'{x[0]} - {LanguageDict[x[1]]}')) for x in list]
throws an error because LanguageDict doasn't have None key

@Murtrag Murtrag added the bug Something isn't working label Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant