Could someone please tell me if this is an unfixed bug in Django 0.95.
If it is I will submit a ticket.

I created a many-to-many relationship using an intermediate table
similar to
http://www.djangoproject.com/documentation/models/m2m_intermediary/
(see model below.)

I am able to successfully exercise the models with no problem in the
shell.

When I go to the Admin and I create an Action or a Reference document
and click on save the Admin throws an exception. But the Action or
Reference is still added to the database.

I searched existing tickets and found similar issues but I'm not sure
if they address the same circumstances.

Thanks,
/Paul


Models:

-----------------------------------------
from django.db import models

class Action(models.Model):

    name = models.CharField(maxlength=20)

    class Admin:
        pass

class ReferenceDocument(models.Model):

    document_number = models.CharField("Document",maxlength=50,
core=True)
    document_type = models.CharField(maxlength=5)

    class Admin:
        pass

    def __str__(self):
        return self.document_number

class ActionReference(models.Model):

    action = models.ForeignKey(Action)
    reference_document = models.ForeignKey(ReferenceDocument)
    note = models.CharField(maxlength=50)

    class Admin:
        pass
------------------------------------------

The exception and traceback:

ProgrammingError at /admin/mmm/referencedocument/add/
ERROR: insert or update on table "django_admin_log" violates foreign
key constraint "django_admin_log_content_type_id_fkey" DETAIL: Key
(content_type_id)=(15) is not present in table "content_types"
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/mmm/referencedocument/add/
Exception Type: ProgrammingError
Exception Value: ERROR: insert or update on table "django_admin_log"
violates foreign key constraint "django_admin_log_content_type_id_fkey"
DETAIL: Key (content_type_id)=(15) is not present in table
"content_types"
Exception Location:
c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\db\backends\util.py
in execute, line 12

Traceback (most recent call last):
File
"c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\core\handlers\base.py"
in get_response
  74. response = callback(request, *callback_args, **callback_kwargs)
File
"c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\contrib\admin\views\decorators.py"
in _checklogin
  55. return view_func(request, *args, **kwargs)
File
"c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\views\decorators\cache.py"
in _wrapped_view_func
  39. response = view_func(request, *args, **kwargs)
File
"c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\contrib\admin\views\main.py"
in add_stage
  256. LogEntry.objects.log_action(request.user.id,
ContentType.objects.get_for_model(model).id, pk_value, str(new_object),
ADDITION)
File
"c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\contrib\admin\models.py"
in log_action
  13. e.save()
File
"c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\db\models\base.py"
in save
  203. ','.join(placeholders)), db_values)
File
"c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\db\backends\util.py"
in execute
  12. return self.cursor.execute(sql, params)

  ProgrammingError at /admin/mmm/action/add/
  ERROR: insert or update on table "django_admin_log" violates foreign
key constraint "django_admin_log_content_type_id_fkey" DETAIL: Key
(content_type_id)=(13) is not present in table "content_types"


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to