Hi everyone,

I'm using Nathan Borror's blog application which uses django's comment
framework. I'm using django with a postgres database. Now, each time I
try to add a comment, there is an IntegrityError:

Environment:

Request Method: POST
Request URL: http://10.10.10.3:8080/comments/post/
Django Version: 1.2.1
Python Version: 2.6.5
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.comments',
 'django.contrib.contenttypes',
 'django.contrib.markup',
 'django.contrib.messages',
 'django.contrib.sessions',
 'django.contrib.sites',
 'basic.blog',
 'basic.inlines',
 'tagging']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
base.py" in get_response
  100.                     response = callback(request,
*callback_args, **callback_kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/utils/
decorators.py" in _wrapped_view
  76.                     response = view_func(request, *args,
**kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/
http.py" in inner
  37.             return func(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/comments/
views/comments.py" in post_comment
  123.     comment.save()
File "/usr/local/lib/python2.6/dist-packages/django/contrib/comments/
models.py" in save
  85.         super(Comment, self).save(*args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py"
in save
  435.         self.save_base(using=using, force_insert=force_insert,
force_update=force_update)
File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py"
in save_base
  535.             transaction.commit_unless_managed(using=using)
File "/usr/local/lib/python2.6/dist-packages/django/db/transaction.py"
in commit_unless_managed
  175.         connection._commit()
File "/usr/local/lib/python2.6/dist-packages/django/db/backends/
__init__.py" in _commit
  32.             return self.connection.commit()

Exception Type: IntegrityError at /comments/post/
Exception Value: insert or update on table "django_comments" violates
foreign key constraint "django_comments_site_id_fkey"
DETAIL:  Key (site_id)=(1) is not present in table "django_site".


It is right, the key 1 does not exist in django_site, because I
deleted example.com via the admin site. I didn't think it was
important. Was I wrong?

I'm a bit puzzled here. The traceback doesn't contain any of Nathan's
or my code, it's only code that django ships with. It's called via a
blog template:
    {% render_comment_form for object %}

Would be glad if someone could help me to solve this.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to