Open mahesh-ziffi opened 8 years ago
On line 315 of quiz/models.py:
Replace:
question_set = question_set.values_list('id', flat=True)
with
question_set = [item.id for item in question_set]
I think the issue is that model_utils changed and that question_set is different. I am not sure though, and this got it working for me.
I faced the mentioned error even with this change above, however, this issue is resolved by updating django-model-utils (tested on version 2.5.2) pip install django-model-utils==2.5.2
У мене та сама помилка, будь ласка, допоможіть
I' m noob to Django and was trying to run the app. I simply downloaded the app and getting the following error.
Environment:
Request Method: GET Request URL: http://127.0.0.1:8000/quiz/test1/take/
Django Version: 1.9.1 Python Version: 2.7.10 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'true_false', 'quiz', 'multichoice', 'essay', 'aetsv_apps_2.agriera_apps.mysite', 'aetsv_apps_2.agriera_apps.myapp'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', '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']
Traceback:
File "/home/mahesh/anaconda2/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
File "/home/mahesh/anaconda2/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
File "/home/mahesh/anaconda2/lib/python2.7/site-packages/django/views/generic/base.py" in view
File "/home/mahesh/anaconda2/lib/python2.7/site-packages/django_quiz_app-0.5.1-py2.7.egg/quiz/views.py" in dispatch
File "/home/mahesh/anaconda2/lib/python2.7/site-packages/django_quiz_app-0.5.1-py2.7.egg/quiz/models.py" in user_sitting
File "/home/mahesh/anaconda2/lib/python2.7/site-packages/django_quiz_app-0.5.1-py2.7.egg/quiz/models.py" in new_sitting
File "/home/mahesh/anaconda2/lib/python2.7/site-packages/django/db/models/query.py" in len
File "/home/mahesh/anaconda2/lib/python2.7/site-packages/django/db/models/query.py" in _fetch_all
File "/home/mahesh/anaconda2/lib/python2.7/site-packages/model_utils/managers.py" in iterator
File "/home/mahesh/anaconda2/lib/python2.7/site-packages/model_utils/managers.py" in _get_sub_obj_recurse
Exception Type: AttributeError at /quiz/test1/take/ Exception Value: 'long' object has no attribute 'essay_question'