I'm trying to install django_quiz
GITHUB app into my Django
project. I've done everything which is in the "Installation" readme file but it raises error:
return super(InheritanceQuerySetMixin, self)._clone(klass, setup, **kwargs)
TypeError: _clone() takes exactly 1 argument (3 given)
So I did
python pip install Pillow
, pip install django-model-utils
manage.py
, apps dir etc.).cd django_quiz
python setup.py install
'quiz', 'multichoice', 'true_false', 'essay'
to INSTALLED_APPS
url(r'^q/', include('quiz.urls'))
, into urlpatterns
( urls.py
) After this, I tried to python manage.py runserver
and the error raised. So I tried already do makemigrations but the same error happend.
Here is the whole traceback from cmd line (after runserver
):
C:\Users\Milano\PycharmProjects\FutileStudio\SolutionsForLanguages_2\venv\lib\si
te-packages\django_model_utils-2.0.3-py2.7.egg\model_utils\managers.py:106: Remo
vedInDjango110Warning: 'get_all_related_objects is an unofficial API that has be
en deprecated. You may be able to replace it with 'get_fields()'
rel for rel in model._meta.get_all_related_objects()
C:\Users\Milano\PycharmProjects\FutileStudio\SolutionsForLanguages_2\venv\lib\si
te-packages\django_model_utils-2.0.3-py2.7.egg\model_utils\managers.py:106: Remo
vedInDjango110Warning: 'get_all_related_objects is an unofficial API that has be
en deprecated. You may be able to replace it with 'get_fields()'
rel for rel in model._meta.get_all_related_objects()
Unhandled exception in thread started by <function wrapper at 0x033284F0>
Traceback (most recent call last):
File "C:\Users\Milano\PycharmProjects\FutileStudio\SolutionsForLanguages_2\ven
v\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "C:\Users\Milano\PycharmProjects\FutileStudio\SolutionsForLanguages_2\ven
v\lib\site-packages\django\core\management\commands\runserver.py", line 109, in
inner_run
autoreload.raise_last_exception()
File "C:\Users\Milano\PycharmProjects\FutileStudio\SolutionsForLanguages_2\ven
v\lib\site-packages\django\utils\autoreload.py", line 249, in raise_last_excepti
on
six.reraise(*_exception)
File "C:\Users\Milano\PycharmProjects\FutileStudio\SolutionsForLanguages_2\ven
v\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "C:\Users\Milano\PycharmProjects\FutileStudio\SolutionsForLanguages_2\ven
v\lib\site-packages\django\__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Milano\PycharmProjects\FutileStudio\SolutionsForLanguages_2\ven
v\lib\site-packages\django\apps\registry.py", line 115, in populate
app_config.ready()
File "C:\Users\Milano\PycharmProjects\FutileStudio\SolutionsForLanguages_2\ven
v\lib\site-packages\django\contrib\admin\apps.py", line 22, in ready
self.module.autodiscover()
File "C:\Users\Milano\PycharmProjects\FutileStudio\SolutionsForLanguages_2\ven
v\lib\site-packages\django\contrib\admin\__init__.py", line 26, in autodiscover
autodiscover_modules('admin', register_to=site)
File "C:\Users\Milano\PycharmProjects\FutileStudio\SolutionsForLanguages_2\ven
v\lib\site-packages\django\utils\module_loading.py", line 50, in autodiscover_mo
dules
import_module('%s.%s' % (app_config.name, module_to_search))
File "c:\python27\Lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "C:\Users\Milano\PycharmProjects\FutileStudio\SolutionsForLanguages_2\ven
v\lib\site-packages\django_quiz_app-0.5.1-py2.7.egg\quiz\admin.py", line 16, in
<module>
class QuizAdminForm(forms.ModelForm):
File "C:\Users\Milano\PycharmProjects\FutileStudio\SolutionsForLanguages_2\ven
v\lib\site-packages\django_quiz_app-0.5.1-py2.7.egg\quiz\admin.py", line 29, in
QuizAdminForm
queryset=Question.objects.all().select_subclasses(),
File "C:\Users\Milano\PycharmProjects\FutileStudio\SolutionsForLanguages_2\ven
v\lib\site-packages\django_model_utils-2.0.3-py2.7.egg\model_utils\managers.py",
line 48, in select_subclasses
new_qs = self.select_related(*subclasses)
File "C:\Users\Milano\PycharmProjects\FutileStudio\SolutionsForLanguages_2\ven
v\lib\site-packages\django\db\models\query.py", line 852, in select_related
obj = self._clone()
File "C:\Users\Milano\PycharmProjects\FutileStudio\SolutionsForLanguages_2\ven
v\lib\site-packages\django_model_utils-2.0.3-py2.7.egg\model_utils\managers.py",
line 61, in _clone
return super(InheritanceQuerySetMixin, self)._clone(klass, setup, **kwargs)
TypeError: _clone() takes exactly 1 argument (3 given)
Do you know where is the problem?
转到 manager.py 中的 InheritanceQuerySetMixin 类,从 def _clone() 中删除参数 klass、setup,然后运行 python manage.py makemigrations for quiz、essay、multichoice、true_false 并运行 python manage.py migrate ,最后运行 python manage .py 运行服务器 8000
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.