afinidata2019 / afinidata-content-manager

Content manager
GNU Affero General Public License v3.0
0 stars 1 forks source link

Break when post has no Taxonomy #17

Closed tian2992 closed 5 years ago

tian2992 commented 5 years ago
Internal Server Error: /posts/283/edit/
Traceback (most recent call last):
  File "/home/ubuntu/content_manager_venv/lib/python3.5/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/home/ubuntu/content_manager_venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/ubuntu/content_manager_venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/ubuntu/content_manager_venv/lib/python3.5/site-packages/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/ubuntu/content_manager_venv/lib/python3.5/site-packages/django/contrib/auth/mixins.py", line 52, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/home/ubuntu/content_manager_venv/lib/python3.5/site-packages/django/views/generic/base.py", line 97, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/ubuntu/content_manager_venv/lib/python3.5/site-packages/django/views/generic/edit.py", line 190, in get
    return super().get(request, *args, **kwargs)
  File "/home/ubuntu/content_manager_venv/lib/python3.5/site-packages/django/views/generic/edit.py", line 133, in get
    return self.render_to_response(self.get_context_data())
  File "/home/ubuntu/content_manager/posts/views.py", line 328, in get_context_data
    if post.taxonomy:
  File "/home/ubuntu/content_manager_venv/lib/python3.5/site-packages/django/db/models/fields/related_descriptors.py", line 415, in __get__
    self.related.get_accessor_name()
posts.models.Post.taxonomy.RelatedObjectDoesNotExist: Post has no taxonomy.
GET /posts/283/edit/ - 500
tian2992 commented 5 years ago

Fixed on last merge