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 cloning region without imprint #2153

Closed
timobrembeck opened this issue Mar 23, 2023 · 0 comments · Fixed by #2154
Closed

AttributeError when cloning region without imprint #2153

timobrembeck opened this issue Mar 23, 2023 · 0 comments · Fixed by #2154
Assignees
Labels
🍼 good first issue Good for newcomers 🐛 bug Something isn't working ⁉️ prio: low Not urgent, can be resolved in the distant future. ☺️ effort: low Should be doable in <4h
Milestone

Comments

@timobrembeck
Copy link
Member

Describe the Bug

When a region is cloned that has no imprint, an internal server error occurs.
The region is created, but the duplication process is not completed.

Steps to Reproduce

  1. Clone region without imprint (e.g. Nürnberg in the test data)
  2. See error

Expected Behavior

The region should be cloned and all contents should be copied

Actual Behavior

AttributeError: 'NoneType' object has no attribute 'region'

Additional Information

Traceback
Internal Server Error: /regions/new/
Traceback (most recent call last):
File "/home/timo/job/integreat/integreat-cms/.venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 47, in inner
  response = get_response(request)
File "/home/timo/job/integreat/integreat-cms/.venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 181, in _get_response
  response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/timo/job/integreat/integreat-cms/.venv/lib/python3.10/site-packages/django/views/generic/base.py", line 70, in view
  return self.dispatch(request, *args, **kwargs)
File "/home/timo/job/integreat/integreat-cms/.venv/lib/python3.10/site-packages/django/contrib/auth/mixins.py", line 104, in dispatch
  return super().dispatch(request, *args, **kwargs)
File "/home/timo/job/integreat/integreat-cms/.venv/lib/python3.10/site-packages/django/views/generic/base.py", line 98, in dispatch
  return handler(request, *args, **kwargs)
File "/home/timo/job/integreat/integreat-cms/.venv/lib/python3.10/site-packages/django/views/generic/edit.py", line 172, in post
  return super().post(request, *args, **kwargs)
File "/home/timo/job/integreat/integreat-cms/.venv/lib/python3.10/site-packages/django/views/generic/edit.py", line 142, in post
  return self.form_valid(form)
File "/home/timo/job/integreat/integreat-cms/integreat_cms/cms/views/form_views.py", line 127, in form_valid
  return super().form_valid(form)
File "/home/timo/job/integreat/integreat-cms/.venv/lib/python3.10/site-packages/django/views/generic/edit.py", line 125, in form_valid
  self.object = form.save()
File "/home/timo/job/integreat/integreat-cms/integreat_cms/cms/forms/regions/region_form.py", line 211, in save
  duplicate_imprint(source_region, region)
File "/home/timo/job/integreat/integreat-cms/integreat_cms/cms/forms/regions/region_form.py", line 733, in duplicate_imprint
  target_imprint.region = target_region
AttributeError: 'NoneType' object has no attribute 'region'
@timobrembeck timobrembeck added 🐛 bug Something isn't working 🍼 good first issue Good for newcomers ⁉️ prio: low Not urgent, can be resolved in the distant future. ☺️ effort: low Should be doable in <4h labels Mar 23, 2023
@timobrembeck timobrembeck added this to the 23Q1 milestone Mar 23, 2023
@timobrembeck timobrembeck self-assigned this Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍼 good first issue Good for newcomers 🐛 bug Something isn't working ⁉️ prio: low Not urgent, can be resolved in the distant future. ☺️ effort: low Should be doable in <4h
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant