Hm, well that sounds much more logical! The only reason I'm reluctant to believe that's the problem, though I hope it is, is because I've even tried this with just two rows in the spreadsheet (i.e. one row of the column names and one row of sample data).
In my script, site_id, as always is 1 and is 1 in every row entry, so this error really just means that the slugs are not unique since each will always be combined with '1', correct? My slug is given by: p.slug = row[3] + str(row[0]) Where row[3] could be the same string (but isn't) and row[0] is always a unique integer (product id). So, I don't see how it's possible that this combination could not be unique. It is not even allowing me to add one row to the database. (I should note that I can add products just fine in the Admin Page). Brendan On Apr 19, 5:17 pm, Ryan Headley <[email protected]> wrote: > maybe i'm mis understanding your explanation, but its not telling you that > slug is the same as site_id, its saying the combination of slug and site_id > aren't unique. > > Somewhere in your import of data you have an object that has the same slug > as another. > > e.g. product1-site1 appears multiple times. > > Ryan > > > > On Tue, Apr 19, 2011 at 4:14 PM, Brendan F <[email protected]> wrote: > > Hello, > > > I can't for the life of me figure out the root of this error: > > > IntegrityError: columns site_id, slug are not unique > > > I am using a modified version of the script found here: > > >http://djangosnippets.org/snippets/2255/ > > > I am using it to import a spreadsheet of a couple hundred products, > > but I have cut it down to only a few rows for testing. I am > > consistently getting errors about columns not being unique, but it's > > really frustrating because I don't know how these columns aren't > > unique. > > > The site is 'localhost' and id=1. Slug is a concatenation of a few > > different strings in different columns, so I just can't understand how > > they could not be unique. Is there anyway to make it so that site_id > > and slug don't have to be unique. Better yet, is there any way to > > figure out why the heck this is happening. (If I do print statements > > of the strings I am assigning, I can see clearly that site is > > 'localhost' and id=1 and that slug is a different string). > > > I'm surely just missing something about the whole "unique_together" > > requirement, so maybe someone can enlighten me about this general > > issue. (I did not want to paste in any code quite yet because I > > figure some general understanding about this will solve my issue. I > > am having a painful time finding any info about this elsewhere.) > > > Thank you! > > > -- > > You received this message because you are subscribed to the Google Groups > > "Satchmo users" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group at > >http://groups.google.com/group/satchmo-users?hl=en. > > --http://www.sudovi.com/http://www.twitter.com/lifewithryanhttp://www.thecommontongue.comhttp://www.lifewithryan.com/ -- You received this message because you are subscribed to the Google Groups "Satchmo users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/satchmo-users?hl=en.
