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

AttributeError when dashboard is opened in region without default language #2834

Closed
timobrembeck opened this issue Jun 8, 2024 · 1 comment · Fixed by #2835
Closed

AttributeError when dashboard is opened in region without default language #2834

timobrembeck opened this issue Jun 8, 2024 · 1 comment · Fixed by #2835
Assignees
Labels
bug Something isn't working effort: low Should be doable in <4h prio: medium Should be scheduled in the forseeable future.
Milestone

Comments

@timobrembeck
Copy link
Member

timobrembeck commented Jun 8, 2024

Describe the Bug

Steps to Reproduce

  1. Go to A region without default language
  2. See error

Expected Behavior

The dashboard should show anyways

Actual Behavior

AttributeError at /testumgebung/

'NoneType' object has no attribute 'slug'

Additional Information

This is a regression of #2767.

Traceback
Environment:


Request Method: GET
Request URL: http://localhost:8000/testumgebung/

Django Version: 4.2.13
Python Version: 3.11.9
Installed Applications:
['integreat_cms.cms',
'integreat_cms.core',
'integreat_cms.deepl_api',
'integreat_cms.google_translate_api',
'integreat_cms.firebase_api',
'integreat_cms.gvz_api',
'integreat_cms.matomo_api',
'integreat_cms.nominatim_api',
'integreat_cms.summ_ai_api',
'integreat_cms.textlab_api',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.humanize',
'django.contrib.messages',
'django.contrib.sessions',
'django.contrib.sitemaps',
'django.contrib.staticfiles',
'corsheaders',
'db_mutex',
'import_export',
'linkcheck',
'polymorphic',
'rules.apps.AutodiscoverRulesConfig',
'treebeard',
'webpack_loader',
'widget_tweaks',
'cacheops',
'django.contrib.admin',
'debug_toolbar']
Installed Middleware:
['django.middleware.gzip.GZipMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'integreat_cms.core.middleware.RegionMiddleware',
'integreat_cms.core.middleware.AccessControlMiddleware',
'integreat_cms.core.middleware.TimezoneMiddleware',
'integreat_cms.api.middleware.JsonDebugToolbarMiddleware']



Traceback (most recent call last):
File "/home/timo/job/integreat/integreat-cms/.venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
  response = get_response(request)
             ^^^^^^^^^^^^^^^^^^^^^
File "/home/timo/job/integreat/integreat-cms/.venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
  response = wrapped_callback(request, *callback_args, **callback_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/timo/job/integreat/integreat-cms/.venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
  return self.dispatch(request, *args, **kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/timo/job/integreat/integreat-cms/.venv/lib/python3.11/site-packages/django/views/generic/base.py", line 143, in dispatch
  return handler(request, *args, **kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/timo/job/integreat/integreat-cms/.venv/lib/python3.11/site-packages/django/views/generic/base.py", line 226, in get
  context = self.get_context_data(**kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/timo/job/integreat/integreat-cms/integreat_cms/cms/views/dashboard/dashboard_view.py", line 69, in get_context_data
  context.update(self.get_drafted_pages())
                 ^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/timo/job/integreat/integreat-cms/integreat_cms/cms/views/dashboard/dashboard_view.py", line 242, in get_drafted_pages
  language__slug=self.request.region.default_language.slug,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Exception Type: AttributeError at /testumgebung/
Exception Value: 'NoneType' object has no attribute 'slug'

@timobrembeck timobrembeck added bug Something isn't working prio: medium Should be scheduled in the forseeable future. effort: low Should be doable in <4h labels Jun 8, 2024
@timobrembeck timobrembeck added this to the 24Q2 milestone Jun 8, 2024
@timobrembeck timobrembeck self-assigned this Jun 8, 2024
@MizukiTemma
Copy link
Member

FYI: It seems the region Tesumgebung in the test data has a language but you can reproduce the reported bug if you simply delete the language and try to come back to the dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working effort: low Should be doable in <4h prio: medium Should be scheduled in the forseeable future.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants