You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
The text was updated successfully, but these errors were encountered:
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
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
Desktop (please complete the following information):
Hosting
Digital Ocean droplet running Ubuntu 22.04.
The text was updated successfully, but these errors were encountered: