On Tue, 2009-02-03 at 19:10 -0800, Eric Abrahamsen wrote: > Hi there, > > I'm unable to do any testing -- my fixtures fail with a "Duplicate > Entry" error when loading. From what I've googled, this might have > something to do with a mismatch between my model definitions and the > sql table definition.
"Duplicate Entry" is the database telling you that some column(s) with a unique constraint are failing the constraint check. So it's database-level data related and the first thing to check is the data you're trying to insert. [...] > The only unusual thing about the second record is that it's the first > one with "characters" set to an empty string. I'm using a django > updated earlier in the day. If the primary key specified in the data you're trying to insert? If so, and it's not different between the two, that's one case of a unique field that will be causing you problems. If you know which two records are causing the problem, another part of reducing the problem to the simplest case is to try a few experiements. Each time, change one of the pieces of data in the second entry. At some point, you'll change the attribute that is causing the problem, so you'll at least know which one it is. > > model > #### > > class Author(models.Model): > surname = models.CharField(max_length=30) > given_name = models.CharField(max_length=30) > slug = models.SlugField(blank=True) > characters = models.CharField(max_length=6,blank=True) > user = models.ForeignKey(User, blank=True, null=True) > ...more Yeah, that "more" bit is no doubt containing important information. For example, do you have a Meta inner class that is defining any unique_together constraints? Do any of the fields you've omitted have unique=True on them? Which columns in the database table require the entries to be unique? Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---