Wednesday, December 12, 2012

validation error in Django Admin

I'm getting an unexpected validation error in Admin which baffles me.
Any hints appreciated ... here is the traceback

http://dpaste.com/844972/

At the bottom of the traceback where the error is raised, the local vars
are ...

self <django.forms.models.ModelChoiceField object at 0x02414890>
value u'33'
key 'pk'

When I save the item, it auto-generates many-to-many connections to a
few standard images in the database via a through table. However there
is a rule which says "if ever these two images are connected to an item,
only keep this one and drop that one."

I use a post-save signal to "drop that one" using ...

Item_Pictogram.objects.filter(item=instance, pictogram=pic,
via='auto').delete()

The local var value above being u'33' happens to be the exact pk of the
Item_Pictogram record I want to delete - I checked in Postgres.

The pk should be an integer but I suppose that's nothing.

Thanks for any help

Mike

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate