django-filer icon indicating copy to clipboard operation
django-filer copied to clipboard

django_polymorphic: result objects do not have unique primary keys

Open johnraz opened this issue 12 years ago • 5 comments

I'm facing this error when using django-filer along with django_cms:

Error during template rendering

 In template /opt/xxx/local/lib/python2.7/site-packages/filer/templates/admin/filer/tools/clipboard/clipboard_item_rows.html, error at line 1
django_polymorphic: result objects do not have unique primary keys - model <class 'filer.models.filemodels.File'>

Database used is postgress

It occurs whenever I try to access a filer related page and only with one single user. Didn't have the chance to dig yet, just filling an issue here if someone already knows better.

johnraz avatar Dec 12 '12 12:12 johnraz

Sorry for the delayed response @johnraz. Are you still having this issue? Can you provide more details and package versions (django-filer, django, django_polymorphic)

stefanfoulis avatar Jan 22 '13 03:01 stefanfoulis

Hello @stefanfoulis , no worries we all are very busy.

My package versions: Django==1.4.3 django-filer==0.9.1 django-polymorphic==0.2 django-cms==2.3.5 cmsplugin-filer==0.9

The scenario: User is trying to upload a file with cms_plugin. Somehow it fails and from then the user cannot acces the admin at all. This is cause by an assert in django-polymorphic that says that there is a conflict in pk: See: https://github.com/bconstantin/django_polymorphic/blob/master/polymorphic/query.py#L145

I commented, the raise (yea dirty), and everything seems to be ok.

This occured only for one of my customer using firefox for mac ... So as I don't own a mac, I wasn't able to reproduce, just to play with the actual broken database...

Maybe this not unique pk rings any bell ?

johnraz avatar Jan 22 '13 14:01 johnraz

I had same problem and solved it by deleting everything from 'filer_clipboarditems' table. Strange thing it had some rows with same 'file_id' value

isungurov avatar Feb 26 '13 18:02 isungurov

+1 for clearing out the filer_clipboarditem table fixing this issue. The following query finds the (possibly) offending rows: select file_id, count(file_id) from filer_clipboarditem group by file_id having (count(file_id) > 1);

thnee avatar Apr 12 '13 18:04 thnee

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] avatar Jul 29 '22 00:07 stale[bot]

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

stale[bot] avatar Aug 30 '22 17:08 stale[bot]