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

Fix device list link when main department is set #396

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

octomike
Copy link
Member

Currently the "More…" button on widgets trigger

Traceback (most recent call last):
  File "/home/mk/work/src/Lagerregal/.venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/home/mk/work/src/Lagerregal/.venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/mk/work/src/Lagerregal/.venv/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/mk/work/src/Lagerregal/.venv/lib/python3.9/site-packages/django/contrib/auth/mixins.py", line 104, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/home/mk/work/src/Lagerregal/.venv/lib/python3.9/site-packages/django/views/generic/base.py", line 98, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/mk/work/src/Lagerregal/.venv/lib/python3.9/site-packages/django/views/generic/list.py", line 142, in get
    self.object_list = self.get_queryset()
  File "/home/mk/work/src/Lagerregal/devices/views.py", line 162, in get_queryset
    devices = get_devices(self.request.user, self.viewfilter, self.departmentfilter, self.viewsorting)
  File "/home/mk/work/src/Lagerregal/devices/views.py", line 124, in get_devices
    raise ValueError
ValueError

when the current user has a main department set.

@xi
Copy link
Collaborator

xi commented Nov 24, 2021

As far as I understand you removed some of the main department functionality, correct? This sounds to me more like a workaround than a fix. Maybe we should create an issue to not forget about a proper fix in the long run.

@octomike
Copy link
Member Author

octomike commented Nov 24, 2021

The DeviceList view defaults to my departments, when the parameter is not set. Yes, the implied functionality change is that the device list then contains all devices from all of the user's departments instead of just from their main department. It fixes the bug and makes more sense imho.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants