stxnext-csr / volontulo

Web portal for collaboration of community volunteers with organizations and institutions.
MIT License
14 stars 24 forks source link

AnonymousUser raise error on offers/join #262

Closed magul closed 9 years ago

magul commented 9 years ago

Environment:

Request Method: GET Request URL: http://localhost:8000/volontulo/offers/dadad/14/join

Django Version: 1.8.4 Python Version: 3.4.3 Installed Applications: ('django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'bootstrap3', 'volontulo') Installed Middleware: ('django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware')

Traceback: File "/home/tmagulski/.virtualenvs/volontulo/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response

  1. response = wrapped_callback(request, _callback_args, *_callback_kwargs) File "/home/tmagulski/Dokumenty/volontulo/volontuloapp_org/volontuloapp_org/../volontulo/volontulo/views/offers.py" in offers_join
  2. volunteer_user = UserProfile.objects.get(user=request.user) File "/home/tmagulski/.virtualenvs/volontulo/lib/python3.4/site-packages/django/db/models/manager.py" in manager_method
  3. return getattr(self.get_queryset(), name)(_args, *_kwargs) File "/home/tmagulski/.virtualenvs/volontulo/lib/python3.4/site-packages/django/db/models/query.py" in get
  4. clone = self.filter(_args, *_kwargs) File "/home/tmagulski/.virtualenvs/volontulo/lib/python3.4/site-packages/django/db/models/query.py" in filter
  5. return self._filter_or_exclude(False, _args, *_kwargs) File "/home/tmagulski/.virtualenvs/volontulo/lib/python3.4/site-packages/django/db/models/query.py" in _filter_or_exclude
  6. clone.query.add_q(Q(_args, *_kwargs)) File "/home/tmagulski/.virtualenvs/volontulo/lib/python3.4/site-packages/django/db/models/sql/query.py" in add_q
  7. clause, require_inner = self._add_q(where_part, self.used_aliases) File "/home/tmagulski/.virtualenvs/volontulo/lib/python3.4/site-packages/django/db/models/sql/query.py" in _add_q
  8. allow_joins=allow_joins, split_subq=split_subq, File "/home/tmagulski/.virtualenvs/volontulo/lib/python3.4/site-packages/django/db/models/sql/query.py" in build_filter
  9. lookups, value) File "/home/tmagulski/.virtualenvs/volontulo/lib/python3.4/site-packages/django/db/models/fields/related.py" in get_lookup_constraint
  10. lookup_class(target.get_col(alias, source), val), AND) File "/home/tmagulski/.virtualenvs/volontulo/lib/python3.4/site-packages/django/db/models/lookups.py" in init
  11. self.rhs = self.get_prep_lookup() File "/home/tmagulski/.virtualenvs/volontulo/lib/python3.4/site-packages/django/db/models/lookups.py" in get_prep_lookup
  12. return self.lhs.output_field.get_prep_lookup(self.lookup_name, self.rhs) File "/home/tmagulski/.virtualenvs/volontulo/lib/python3.4/site-packages/django/db/models/fields/init.py" in get_prep_lookup
  13. return self.get_prep_value(value) File "/home/tmagulski/.virtualenvs/volontulo/lib/python3.4/site-packages/django/db/models/fields/init.py" in get_prep_value
  14. return int(value)

Exception Type: TypeError at /volontulo/offers/dadad/14/join Exception Value: int() argument must be a string, a bytes-like object or a number, not 'SimpleLazyObject'

magul commented 9 years ago

This bug depends on #249 reset-password functionality. It will require also to reafactor user creation (it will be possible from register page and from here, from here it will create random password and send reset-password link via email).