I think this is the same error I'm seeing in http://code.djangoproject.com/ticket/9076. It involves getting duplicate pks from the form. I've used the below workaround in the meantime.
Index: django/forms/models.py =================================================================== --- django/forms/models.py (revision 8961) +++ django/forms/models.py (working copy) @@ -336,7 +336,7 @@ def _construct_form(self, i, **kwargs): if i < self._initial_form_count: - kwargs['instance'] = self.get_queryset()[i] + kwargs['instance'] = list(self.get_queryset())[i] return super(BaseModelFormSet, self)._construct_form(i, **kwargs) def get_queryset(self): On Sep 14, 9:26 am, Marek Kubica <[EMAIL PROTECTED]> wrote: > Hi, > > I fought against this for the whole day already (with patching Django; > creating Form and FormSet subclasses etc.) but nothing helped. I want to > have a Message with multiple translations in my database and the admin > should display the message and the translations inline. > > Now the problem is, that the following works and sometimes saving in the > admin fails with "Please correct the errors below." and no errors below > that. When I patched the template to show {{ errors }} I also get this: > > Translation with this None already exists. > > When I take a look on the errors of the translation formset I get this: > > [{'id': [u'Translation with this None already exists.']}, {}] > > The only solution this far was creating a new message, copying stuff over > and deleting the old one. > > I'm running the current Django trunk, but this has been broken for quite > some time. > > The relevant files look like this: > > admin.py > > from sys import maxint > from django.contrib import admin > from pointtec.transdigest import models > > class TranslationInline(admin.TabularInline): > model = models.Translation > > class MessageAdmin(admin.ModelAdmin): > ordering = ('text',) > list_per_page = maxint > search_fields = ('text',) > inlines = [TranslationInline] > > admin.site.register(models.Message, MessageAdmin) > > models.py: > > from django.db import models > from django.conf import settings > from django.utils.translation import get_language, gettext_lazy as _ > > languages_available = settings.LANGUAGES > > class Message(models.Model): > """A message which is to translate""" > text = models.TextField(_('original message'), unique=True) > > def __unicode__(self): > """A nice representation for the user""" > return self.text > > def save(self, *args, **kwargs): > self.text = self.text.strip() > super(Message, self).save(*args, **kwargs) > > class Translation(models.Model): > """Translation""" > message = models.ForeignKey(Message) > language = models.CharField(_('language'), max_length=5, > choices=settings.LANGUAGES) > translation = models.TextField(_('translation')) > > def save(self, *args, **kwargs): > self.translation = self.translation.strip() > super(Translation, self).save(*args, **kwargs) > > def __unicode__(self): > return u"%s: %s" % (self.language, self.translation) > > It would be really nice if someone could show me what I'm doing wrong. > > regards, > Marek --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---