The offending lines are these right here:
File "/var/www/MYPROJECT/data/bookstor/profiles/views.py" in create_profile
49. profile_obj = request.user.get_profile() ## If existing profile found
File "/usr/lib/python2.7/site-packages/django/contrib/auth/models.py" in get_profile
449. self._profile_cache = model._default_manager.using(self._state.db).get(user__id__exact=self.id)
Line 49 in profiles.views is calling get_profile on the user object. In turn, it's trying to dereference the user id in django.contrib.auth.models.
The get_profile() method is deprecated as of 1.5 (although not removed until 1.7). Your best bet is to stop using it in favor of custom user models (https://docs.djangoproject.com/en/1.10/releases/1.5/#auth-profile-module and https://docs.djangoproject.com/en/1.10/topics/auth/customizing/#auth-custom-user) because eventually you'll want to get yourself to a version of Django that's actually getting security updates.
On Wed, Dec 7, 2016 at 1:13 PM, NoviceSortOf <dljonsson2008@gmail.com> wrote:
--While in the process of upgrading from 1.1 to 1.6get_profile() returns a field error.**************************************** Exception Type: FieldErrorException Value: Cannot resolve keyword 'user' into field. Choices are:date_joined, email, first_name, groups, id, is_active, is_staff, is_superuser, last_login, last_name, logentry...**************************************** On close inspection there is no 'user' field defined in_ myproject.profiles.models_ ...\site-packages\django\contrib\auth\models.py _ or in the db auth_user or profile tables.Drilling into all of the files listed in the traceback, (including site packages)I can find no instance of 'user' being assigned as a field.* Where else can I look to find 'user' and/or what is causing the problem.Please advise*****************************TRACEBACK*****************************Environment:Request Method: GETRequest URL: http://myproject.com/profiles/create/ Django Version: 1.6.12Python Version: 2.7.5Installed Applications:('django.contrib.auth','django.contrib.contenttypes', 'django.contrib.sessions','django.contrib.sites','django.contrib.admin','django.contrib.humanize','django.contrib.redirects','bookstor','bookstor.registration','bookstor.profiles','django_extensions','django.contrib.admin','bookstor.cart')Installed Middleware:('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.auth.middleware. AuthenticationMiddleware', 'django.middleware.transaction. TransactionMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.redirects.middleware. RedirectFallbackMiddleware') Traceback:File "/usr/lib/python2.7/site-packages/django/core/handlers/ base.py" in get_response 120. response = wrapped_callback(request, *callback_args, **callback_kwargs)File "/var/www/MYPROJECT/data/bookstor/profiles/views.py" in create_profile 49. profile_obj = request.user.get_profile() ## If existing profile foundFile "/usr/lib/python2.7/site-packages/django/contrib/auth/ models.py" in get_profile 449. self._profile_cache = model._default_manager.using(self._state.db).get(user__id__ exact=self.id) File "/usr/lib/python2.7/site-packages/django/db/models/ query.py" in get 301. clone = self.filter(*args, **kwargs)File "/usr/lib/python2.7/site-packages/django/db/models/ query.py" in filter 593. return self._filter_or_exclude(False, *args, **kwargs)File "/usr/lib/python2.7/site-packages/django/db/models/ query.py" in _filter_or_exclude 611. clone.query.add_q(Q(*args, **kwargs))File "/usr/lib/python2.7/site-packages/django/db/models/sql/ query.py" in add_q 1204. clause = self._add_q(where_part, used_aliases)File "/usr/lib/python2.7/site-packages/django/db/models/sql/ query.py" in _add_q 1240. current_negated=current_negated) File "/usr/lib/python2.7/site-packages/django/db/models/sql/ query.py" in build_filter 1103. allow_explicit_fk=True)File "/usr/lib/python2.7/site-packages/django/db/models/sql/ query.py" in setup_joins 1363. names, opts, allow_many, allow_explicit_fk)File "/usr/lib/python2.7/site-packages/django/db/models/sql/ query.py" in names_to_path 1283. "Choices are: %s" % (name, ", ".join(available)))Exception Type: FieldError at /profiles/create/Exception Value: Cannot resolve keyword 'user' into field. Choices are: date_joined, email, first_name, firstpass, groups, id, is_active, is_staff, is_superuser, last_login, last_name, logentry, password, registrationprofile, user_permissions, username
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com .
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users .
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/316b8d68- .4bb1-426f-bb47-8c271dbe6bb8% 40googlegroups.com
For more options, visit https://groups.google.com/d/optout .
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Bv0ZYXy42JpwZCSjGooo-4jz0iJNW6LboD80oSPTgiyK3aWig%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment