2016-04-02 60 views
1

我試圖安裝django_quizGITHUB應用程序到我的Django項目中。我所做的一切,這是在「安裝」自述文件,但它會引發錯誤:Django - TypeError:_clone()只需要1個參數(3給出)

return super(InheritanceQuerySetMixin, self)._clone(klass, setup, **kwargs) 
TypeError: _clone() takes exactly 1 argument (3 given) 

所以我做

  1. python pip install Pillowpip install django-model-utils
  2. 克隆從GitHub的文件到文件夾中的Django目錄(有manage.py,應用程序目錄等)。
  3. cd django_quiz
  4. python setup.py install
  5. 加入'quiz', 'multichoice', 'true_false', 'essay'INSTALLED_APPS
  6. 加入url(r'^q/', include('quiz.urls')),進urlpatternsurls.py

在此之後,我試圖python manage.py runserver和引發錯誤。所以我已經嘗試makemigrations,但同樣的錯誤發生。

這裏是整個回溯從CMD線(後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) 

你知道問題出在哪裏?

回答

1

轉到InheritanceQuerySetMixin類managers.py,從高清_clone()刪除參數克拉斯,設置 然後運行測驗,散文,multichoice,true_false和, 執行python manage.py遷移蟒蛇manage.py makemigrations,然後 最後運行python manage.py runserver 8000

相關問題