Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntegrityError at /blog/quick-entry/ #235

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

IntegrityError at /blog/quick-entry/ #235

ksysctl opened this issue Apr 17, 2013 · 2 comments

Comments

@ksysctl
Copy link

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
Copy link
Author

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
Copy link
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.

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

No branches or pull requests

2 participants