Skip to content
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.

IntegrityError while importing example database #39

Closed
konr4d opened this issue Jul 10, 2012 · 2 comments
Closed

IntegrityError while importing example database #39

konr4d opened this issue Jul 10, 2012 · 2 comments

Comments

@konr4d
Copy link

konr4d commented Jul 10, 2012

When importing example database I get:
IntegrityError: Could not load cms.Page(pk=1): duplicate key value violates unique constraint "cms_placeholder_pkey"

Whole trace:

/home/konrad/work/pjwstk/sieci_cms/libs/cms/utils/plugins.py:125: DuplicatePlaceholderWarning: Duplicate placeholder found: body
warnings.warn("Duplicate placeholder found: %s" % placeholder, DuplicatePlaceholderWarning)
Problem installing fixture 'example_database.json': Traceback (most recent call last):
File "/home/konrad/work/pjwstk/sieci_cms/libs/django/core/management/commands/loaddata.py", line 196, in handle
obj.save(using=using)
File "/home/konrad/work/pjwstk/sieci_cms/libs/django/core/serializers/base.py", line 165, in save
models.Model.save_base(self.object, using=using, raw=True)
File "/home/konrad/work/pjwstk/sieci_cms/libs/django/db/models/base.py", line 565, in save_base
created=(not record_exists), raw=raw, using=using)
File "/home/konrad/work/pjwstk/sieci_cms/libs/django/dispatch/dispatcher.py", line 172, in send
response = receiver(signal=self, sender=sender, **named)
File "/home/konrad/work/pjwstk/sieci_cms/libs/cms/signals.py", line 218, in update_placeholders
instance.rescan_placeholders()
File "/home/konrad/work/pjwstk/sieci_cms/libs/cms/models/pagemodel.py", line 1071, in rescan_placeholders
placeholder = Placeholder.objects.create(slot=placeholder_name)
File "/home/konrad/work/pjwstk/sieci_cms/libs/django/db/models/manager.py", line 137, in create
return self.get_query_set().create(**kwargs)
File "/home/konrad/work/pjwstk/sieci_cms/libs/django/db/models/query.py", line 377, in create
obj.save(force_insert=True, using=self.db)
File "/home/konrad/work/pjwstk/sieci_cms/libs/django/db/models/base.py", line 463, in save
self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/home/konrad/work/pjwstk/sieci_cms/libs/django/db/models/base.py", line 551, in save_base
result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
File "/home/konrad/work/pjwstk/sieci_cms/libs/django/db/models/manager.py", line 203, in _insert
return insert_query(self.model, objs, fields, **kwargs)
File "/home/konrad/work/pjwstk/sieci_cms/libs/django/db/models/query.py", line 1576, in insert_query
return query.get_compiler(using=using).execute_sql(return_id)
File "/home/konrad/work/pjwstk/sieci_cms/libs/django/db/models/sql/compiler.py", line 910, in execute_sql
cursor.execute(sql, params)
File "/home/konrad/work/pjwstk/sieci_cms/libs/django/db/backends/util.py", line 40, in execute
return self.cursor.execute(sql, params)
File "/home/konrad/work/pjwstk/sieci_cms/libs/django/db/backends/postgresql_psycopg2/base.py", line 52, in execute
return self.cursor.execute(query, args)
IntegrityError: Could not load cms.Page(pk=1): duplicate key value violates unique constraint "cms_placeholder_pkey"

@evildmp
Copy link
Owner

evildmp commented Jul 11, 2012

On Tue, Jul 10, 2012, Konrad Adamczyk reply+i-5529297-55262917f21c8e6c4dff3d6ab31377a88b72cb00-86222@reply.github.co wrote:

When importing example database I get:
IntegrityError: Could not load cms.Page(pk=1): duplicate key value
violates unique constraint "cms_placeholder_pkey"

I am assuming that you are importing the example database into an existing database - in that case you may well get some conflicts with existing placeholders.

@evildmp
Copy link
Owner

evildmp commented Jul 20, 2012

I'd like to close this - can you confirm that this issue only occurred when loading the example database fixture into an existing database?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants