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

Superuser is created with no icon #132

Open
bellisk opened this issue Apr 19, 2024 · 1 comment
Open

Superuser is created with no icon #132

bellisk opened this issue Apr 19, 2024 · 1 comment
Labels
bug Something isn't working reviewed v0.6.0

Comments

@bellisk
Copy link
Contributor

bellisk commented Apr 19, 2024

Describe the bug
The initial user created with python manage.py createsuperuser does not have an icon. This meant that updating the user via https://example.org/username/1/edit failed. I added an icon url to the user via the admin interface and could then update it normally.

To Reproduce

  1. Deploy Ourchive to VPS hosting and set up nginx and SSL as described in https://docs.getourchive.io/admin-getting-started/
  2. See that the initial user does not have an icon: https://example.org/username/1
  3. Go to the user edit page and try to update the user: this fails, even if you upload an icon

Expected behavior
The initial user should have the default icon when it is created. Editing the user should work, whether or not it has an icon originally.

Logs

urllib3.connectionpool DEBUG 2024-04-19 17:45:55,483 connectionpool 14729 139836487424160 http://example.org:80 "PATCH /api/users/1/ HTTP/1.1" 301 178
urllib3.connectionpool DEBUG 2024-04-19 17:45:55,485 connectionpool 14729 139836487424160 Starting new HTTPS connection (1): example.org:443
api.custom_exception_handler WARNING 2024-04-19 17:45:55,614 custom_exception_handler 14730 139836486621024 'icon'
django.request ERROR 2024-04-19 17:45:55,655 log 14730 139836486621024 Internal Server Error: /api/users/1/
Traceback (most recent call last):
  File "/home/ourchive/ourchive/virtualenv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/home/ourchive/ourchive/virtualenv/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/ourchive/ourchive/virtualenv/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
    return view_func(request, *args, **kwargs)
  File "/home/ourchive/ourchive/virtualenv/lib/python3.10/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/ourchive/ourchive/virtualenv/lib/python3.10/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/home/ourchive/ourchive/virtualenv/lib/python3.10/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/home/ourchive/ourchive/virtualenv/lib/python3.10/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/home/ourchive/ourchive/virtualenv/lib/python3.10/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/home/ourchive/ourchive/virtualenv/lib/python3.10/site-packages/rest_framework/generics.py", line 292, in patch
    return self.partial_update(request, *args, **kwargs)
  File "/home/ourchive/ourchive/virtualenv/lib/python3.10/site-packages/rest_framework/mixins.py", line 82, in partial_update
    return self.update(request, *args, **kwargs)
  File "/home/ourchive/ourchive/virtualenv/lib/python3.10/site-packages/rest_framework/mixins.py", line 68, in update
    self.perform_update(serializer)
  File "/home/ourchive/ourchive/ourchive_app/api/views.py", line 456, in perform_update
    serializer.save(attributes=attributes)
  File "/home/ourchive/ourchive/virtualenv/lib/python3.10/site-packages/rest_framework/serializers.py", line 203, in save
    self.instance = self.update(self.instance, validated_data)
  File "/home/ourchive/ourchive/ourchive_app/api/serializers.py", line 254, in update
    if 'icon' in validated_data and not validated_data['icon'] or validated_data['icon'].lower() == 'none':
KeyError: 'icon'
urllib3.connectionpool DEBUG 2024-04-19 17:45:55,658 connectionpool 14729 139836487424160 https://example.org:443 "PATCH /api/users/1/ HTTP/1.1" 500 117401

Desktop (please complete the following information):

  • OS: Linux Mint
  • Browser: Firefox
  • Version: 124

Hosting
Digital Ocean droplet running Ubuntu 22.04.

@c-e-p
Copy link
Collaborator

c-e-p commented Apr 22, 2024

Superuser create script should be updated to account for this.

@c-e-p c-e-p added the bug Something isn't working label Apr 22, 2024
@c-e-p c-e-p added the reviewed label May 9, 2024
@c-e-p c-e-p added the v0.6.0 label Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reviewed v0.6.0
Projects
None yet
Development

No branches or pull requests

2 participants