django_polymorphic: result objects do not have unique primary keys #276

Open
johnraz opened this Issue Dec 12, 2012 · 4 comments

Comments

Projects
None yet
4 participants
Contributor

johnraz commented Dec 12, 2012

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.

Owner

stefanfoulis commented Jan 22, 2013

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)

Contributor

johnraz commented Jan 22, 2013

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 ?

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

thnee commented Apr 12, 2013

+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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment