On Thu, Dec 6, 2012 at 7:25 AM, Larry Martell <[email protected]> wrote: >> >> orm['travelbox.AccommodationImage'].objects.all().update(file='travelbox/accommodation/' >> + F('url')) >> >> However that doesn't work - it executes the following SQL: >> >> UPDATE `travelbox_accommodationimage` SET `file` = >> 'travelbox/accommodation/' + `travelbox_accommodationimage`.`url`; >> args=('travelbox/accommodation/',) >> >> which tries to use '+' on strings which fails with this error: >> >> _mysql_exceptions.Warning: Truncated incorrect DOUBLE value: >> 'travelbox/accommodation/' > > Can't you just do the concatenation into a variable and that pass that in, > e.g.: > > newFile = 'travelbox/accommodation/' + F('url') > orm['travelbox.AccommodationImage'].objects.all().update(file=newFile)
it's the same thing AFAICT. remember that Python evaluates the arguments before calling the method. putting the addition in a variable won't change the value passed to .update() -- Javier -- You received this message because you are subscribed to the Google Groups "Django 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/django-users?hl=en.

