avinassh / della

Della is a Django app for managing Secret Santa/Gift Exchange.
http://avi.im/della
MIT License
47 stars 10 forks source link

500 error if superuser is logged in and clicks on Account #3

Closed SathyaBhat closed 7 years ago

SathyaBhat commented 7 years ago

If you create a user from command line using createsuperuser login and then click on account then it raises a 500 error

ERROR 2016-11-23 15:17:18,964 django.request Internal Server Error: /account/
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/exception.py", line 39, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.4/dist-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/django/utils/decorators.py", line 67, in _wrapper
    return bound_func(*args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/django/utils/decorators.py", line 63, in bound_func
    return func.__get__(self, type(self))(*args2, **kwargs2)
  File "/usr/local/lib/python3.4/dist-packages/django/views/generic/base.py", line 88, in dispatch
    return handler(request, *args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/django/views/generic/edit.py", line 235, in get
    self.object = self.get_object()
  File "./della/user_manager/views.py", line 79, in get_object
    return self.request.user.userprofile
  File "/usr/local/lib/python3.4/dist-packages/django/utils/functional.py", line 235, in inner
    return func(self._wrapped, *args)
  File "/usr/local/lib/python3.4/dist-packages/django/db/models/fields/related_descriptors.py", line 370, in __get__
    self.related.get_accessor_name()
django.db.models.fields.related_descriptors.RelatedObjectDoesNotExist: User has no userprofile.
SathyaBhat commented 7 years ago

Same error happens if you click on "Message Santee"

avinassh commented 7 years ago

The latest master fixes this. And I have also updated in the docs. So now onwards admins won't have those options in the navbar.

Thanks for reporting the issue! 👍