Hi,

I have several character fields with leading and trailing spaces and would 
like to know if it is possible to clean them up with a one-liner...

I tried the following but none of this works:


rooms.objects.all().update(name=F('name').strip())  // AttributeError: 'F' 
object has no attribute 'strip'

rooms.objects.all().update(name=Value(F('name')).strip())  // AttributeError: 
'Value' object has no attribute 'strip'

rooms.objects.all().update(name=name.strip())  // NameError: name 'name' is not 
defined

Also searching via Google did not help.

Of course I could do some loop, but this seems to be not very efficient to me.

Any Idea?

Thomas

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f018f0a5-3a8a-4c28-a1d6-2fb96807093e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to