pinax / django-user-accounts

User accounts for Django
MIT License
1.22k stars 356 forks source link

Account matching query does not exist. #27

Closed mattions closed 12 years ago

mattions commented 12 years ago

Hello,

I've just started an account pinax project, with Django 1.4 and everything from new environment to check the migration from pinax.account.

When a super user is created at the first syncing python manage.py syncdb, it will not have an account active but only a user. Therefore clicking on settings gives back an error.

This problem is there only with a super user, I've tried to create other users and there was no trouble.

This is the traceback, just for reference


Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/account/settings/

Django Version: 1.4
Python Version: 2.7.3
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'pinax_theme_bootstrap_account',
 'pinax_theme_bootstrap',
 'django_forms_bootstrap',
 'account',
 'timezones',
 'metron']
Installed Middleware:
['django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware']

Traceback:
File "/home/mattions/.virtualenvs/pinax/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/home/mattions/.virtualenvs/pinax/local/lib/python2.7/site-packages/django/views/generic/base.py" in view
  48.             return self.dispatch(request, *args, **kwargs)
File "/home/mattions/.virtualenvs/pinax/src/django-user-accounts/account/mixins.py" in dispatch
  17.             return super(LoginRequiredMixin, self).dispatch(request, *args, **kwargs)
File "/home/mattions/.virtualenvs/pinax/local/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
  69.         return handler(request, *args, **kwargs)
File "/home/mattions/.virtualenvs/pinax/local/lib/python2.7/site-packages/django/views/generic/edit.py" in get
  131.         form = self.get_form(form_class)
File "/home/mattions/.virtualenvs/pinax/local/lib/python2.7/site-packages/django/views/generic/edit.py" in get_form
  34.         return form_class(**self.get_form_kwargs())
File "/home/mattions/.virtualenvs/pinax/local/lib/python2.7/site-packages/django/views/generic/edit.py" in get_form_kwargs
  40.         kwargs = {'initial': self.get_initial()}
File "/home/mattions/.virtualenvs/pinax/src/django-user-accounts/account/views.py" in get_initial
  517.         initial["timezone"] = self.request.user.account.timezone
File "/home/mattions/.virtualenvs/pinax/local/lib/python2.7/site-packages/django/utils/functional.py" in inner
  185.         return func(self._wrapped, *args)
File "/home/mattions/.virtualenvs/pinax/local/lib/python2.7/site-packages/django/db/models/fields/related.py" in __get__
  255.             rel_obj = self.get_query_set(instance=instance).get(**params)
File "/home/mattions/.virtualenvs/pinax/local/lib/python2.7/site-packages/django/db/models/query.py" in get
  366.                     % self.model._meta.object_name)

Exception Type: DoesNotExist at /account/settings/
Exception Value: Account matching query does not exist.
dmeehan commented 12 years ago

check issue #26. Looks like this has been fixed in master.

brosner commented 12 years ago

This issue should be fixed now. Make sure you are running the latest version. We are getting closer to a real release too!

mattions commented 12 years ago

Yes,

sorry, forgot to close it!