django-cms / django-filer

File and Image Management Application for django
https://django-filer.readthedocs.io/
Other
1.76k stars 577 forks source link

Seeing error: type object 'Clipboard' has no attribute 'base_objects' #278

Closed chrisfong closed 2 years ago

chrisfong commented 11 years ago

Getting this error when clicking into a folder in the Filer plugin in Django Admin. Can someone point me in the right direction? Thanks.

Environment:

Request Method: GET
Request URL: http://app.locals/admin/filer/folder/1/list/

Django Version: 1.4.3
Python Version: 2.7.2
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'django.contrib.staticfiles',
 'helpers.template',
 'cms',
 'mptt',
 'menus',
 'cms.plugins.text',
 'cms.plugins.picture',
 'cms.plugins.link',
 'cms.plugins.file',
 'cms.plugins.snippet',
 'cms.plugins.googlemap',
 'sekizai',
 'cmsplugin_markup',
 'filer',
 'easy_thumbnails',
 'south',
 'app')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'helpers.middleware.VisitorTokenMiddleware',
 'helpers.middleware.AdminLocaleURLMiddleware',
 'cms.middleware.page.CurrentPageMiddleware',
 'cms.middleware.user.CurrentUserMiddleware',
 'cms.middleware.toolbar.ToolbarMiddleware')

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/cache.py" in _wrapped_view_func
  89.         response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/sites.py" in inner
  196.             return view(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/filer/admin/folderadmin.py" in directory_listing
  293.         for f in file_qs:
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" in _result_iter
  118.                 self._fill_cache()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" in _fill_cache
  892.                     self._result_cache.append(self._iter.next())
File "/usr/local/lib/python2.7/dist-packages/polymorphic/query.py" in iterator
  243.             real_results = self._get_real_instances(base_result_objects)
File "/usr/local/lib/python2.7/dist-packages/polymorphic/query.py" in _get_real_instances
  174.             qs = modelclass.base_objects.filter(pk__in=idlist) # use pk__in instead ####

Exception Type: AttributeError at /admin/filer/folder/1/list/
Exception Value: type object 'Clipboard' has no attribute 'base_objects'
stefanfoulis commented 11 years ago

Sorry for the late response @chrisfong . Did you find a solution? I've not encountered this error before and can't reproduce it.

What version of django and django_polymorphic are you using?

jrutila commented 11 years ago

I am having this same issue with django-filer 0.9.3 django-polymorphic 0.4.0

I do not have the reproduction steps yet, though.

stefanfoulis commented 11 years ago

I suspect his has something to do with django ContentType pks being mixed up. Maybe after loading a dbdump?

jrutila commented 11 years ago

Definitely. I had wrong polymorphic_ctype_id in filer_file table. I did do some database dumping and restoring and must have screwed it there. Everything works now that I changed the polymorphic_ctype_id.

eressler commented 11 years ago

I just ran into this same issue after trying to load data from a dumpdata output. Doing a dump data using natural keys will also prevent this issue from occurring.

./manage.py dumpdata filer > filer.json --natural --indent 4
CalebMuhia commented 11 years ago

Hello Guys,

I have the same problem with a django shop app, after doing the a restore, how exactly do i fix this in the database, how to change the polymorphic_ctype_id,

Thanks guys

outbrito commented 10 years ago

It appears that setting the "polymorphic_ctype_id" to the ContentType relative to filer.file works.

andilabs commented 10 years ago

For me following the hint of eressler about using --natural was the way to go. THANKS!

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 2 years ago

This will now be closed due to inactivity, but feel free to reopen it.