MPIB / Lagerregal

Super awesome inventory System for electronic devices
Other
26 stars 11 forks source link

NoReverseMatch in (some) device views #350

Closed octomike closed 5 years ago

octomike commented 5 years ago

just caught this, don't know what happened yet

Internal Server Error: /devices/1213/
Traceback (most recent call last):
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/core/handlers/base.py", line 145, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/core/handlers/base.py", line 143, in _get_response
    response = response.render()
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/template/response.py", line 106, in render
    self.content = self.rendered_content
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/template/response.py", line 83, in rendered_content
    content = template.render(context, self._request)
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/template/backends/django.py", line 61, in render
    return self.template.render(context)
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/template/base.py", line 171, in render
    return self._render(context)
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/test/utils.py", line 96, in instrumented_test_render
    return self.nodelist.render(context)
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/test/utils.py", line 96, in instrumented_test_render
    return self.nodelist.render(context)
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/template/loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/template/defaulttags.py", line 309, in render
    return nodelist.render(context)
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/template/defaulttags.py", line 209, in render
    nodelist.append(node.render_annotated(context))
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/template/defaulttags.py", line 443, in render
    url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/urls/base.py", line 90, in reverse
    return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
  File "/home/lagerregal/.virtualenvs/lagerregal/lib/python3.6/site-packages/django/urls/resolvers.py", line 673, in _reverse_with_prefix
    raise NoReverseMatch(msg)
django.urls.exceptions.NoReverseMatch: Reverse for 'userprofile' with arguments '('',)' not found. 2 pattern(s) tried: ['profile\\/$', 'users\\/(?P<pk>[0-9]+)\\/$']
octomike commented 5 years ago

https://github.com/MPIB/Lagerregal/blob/develop/templates/devices/device_detail.html#L563 is empty for some revisions

xi commented 5 years ago

Maybe we can just wrap it in a if action.revision.user