IntegrityError at /blog/quick-entry/ #235

Closed
ksysctl opened this Issue Apr 17, 2013 · 2 comments

Comments

2 participants
@ksysctl

ksysctl commented Apr 17, 2013

Python 2.6
Django 1.5.0
Zinnia 0.12.3

When I submit a new post(from quick entry form or normal form) is raised this error:

IntegrityError at /blog/quick-entry/
(1452, 'Cannot add or update a child row: a foreign key constraint fails (my_database.zinnia_entry_sites, CONSTRAINT site_id_refs_id_250ed0b2ebd96f36 FOREIGN KEY (site_id) REFERENCES django_site (id))')

but I see the post was created

I recently installed Zinnia, all tables are empty

| zinnia_entry_authors |
| zinnia_entry_categories |
| zinnia_entry_related |
| zinnia_entry_sites

except zinnia_entry, there exists only one entry the post that I created.

django_site has only one entry.

+----+----------------------------------------+-----------+
| id | domain | name |
+----+----------------------------------------+-----------+
| 1 | my_site.local | Testing Zinnia |
+----+----------------------------------------+-----------+

Entry:
MariaDB [my_database]> select * from zinnia_entry;
+--------+---------------------+-----------------+------+-------+-------+---------+------+--------------+-----------------+-------------------+---------------------+----+------------------+----------------+----------+-------------------+----------+---------------+----------------+-----------------+-------------------+---------------------------+
| status | last_update | comment_enabled | tags | image | title | excerpt | slug | content | end_publication | start_publication | creation_date | id | pingback_enabled | login_required | password | detail_template | featured | comment_count | pingback_count | trackback_count | trackback_enabled | content_template |
+--------+---------------------+-----------------+------+-------+-------+---------+------+--------------+-----------------+-------------------+---------------------+----+------------------+----------------+----------+-------------------+----------+---------------+----------------+-----------------+-------------------+---------------------------+
| 2 | 2013-04-17 16:18:55 | 0 | | | test | | test |

nueva

| NULL | NULL | 2013-04-17 16:18:55 | 5 | 0 | 0 | | entry_detail.html | 0 | 0 | 0 | 0 | 0 | zinnia/_entry_detail.html |
+--------+---------------------+-----------------+------+-------+-------+---------+------+--------------+-----------------+-------------------+---------------------+----+------------------+----------------+----------+-------------------+----------+---------------+----------------+-----------------+-------------------+---------------------------+

@ksysctl

This comment has been minimized.

Show comment Hide comment
@ksysctl

ksysctl Apr 17, 2013

I could create a new entry disabling foreign_key_checks, I use MySQL+InnoDB just for test.

DATABASES = {
...
    'default': {
        'OPTIONS': {
            'init_command': 'SET foreign_key_checks = 0;',
        },
    },

however I should not disable for all tables because I have other apps that need it so I try altering specific Zinnia's tables:

ALTER TABLE zinnia_entry_authors DROP FOREIGN KEY entry_id_refs_id_456b2b7ada51dea2;
ALTER TABLE zinnia_entry_authors DROP FOREIGN KEY author_id_refs_id_410656e2874b02ff;

ALTER TABLE zinnia_entry_sites DROP FOREIGN KEY site_id_refs_id_250ed0b2ebd96f36;
ALTER TABLE zinnia_entry_sites DROP FOREIGN KEY entry_id_refs_id_2ca8c253350895b0;

and now I can create a post.

but I my concern is to alter Zinnia's core tables to do work the blog, that's not good,

Can you verify if there is a bug that's affecting zinnia under this environment?

regards.

ksysctl commented Apr 17, 2013

I could create a new entry disabling foreign_key_checks, I use MySQL+InnoDB just for test.

DATABASES = {
...
    'default': {
        'OPTIONS': {
            'init_command': 'SET foreign_key_checks = 0;',
        },
    },

however I should not disable for all tables because I have other apps that need it so I try altering specific Zinnia's tables:

ALTER TABLE zinnia_entry_authors DROP FOREIGN KEY entry_id_refs_id_456b2b7ada51dea2;
ALTER TABLE zinnia_entry_authors DROP FOREIGN KEY author_id_refs_id_410656e2874b02ff;

ALTER TABLE zinnia_entry_sites DROP FOREIGN KEY site_id_refs_id_250ed0b2ebd96f36;
ALTER TABLE zinnia_entry_sites DROP FOREIGN KEY entry_id_refs_id_2ca8c253350895b0;

and now I can create a post.

but I my concern is to alter Zinnia's core tables to do work the blog, that's not good,

Can you verify if there is a bug that's affecting zinnia under this environment?

regards.

@Fantomas42

This comment has been minimized.

Show comment Hide comment
@Fantomas42

Fantomas42 Apr 26, 2013

Owner

Hi gin,

I'm sorry but I cannot reproduce your issue on mysql.
So I will close the issue.

It seems that you are facing a strange issue.

Owner

Fantomas42 commented Apr 26, 2013

Hi gin,

I'm sorry but I cannot reproduce your issue on mysql.
So I will close the issue.

It seems that you are facing a strange issue.

@Fantomas42 Fantomas42 closed this Apr 26, 2013

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