Re: How to clean up character database fields with leading and trailing spaces

2015-11-04 Thread Derek
Lots of ideas here: http://stackoverflow.com/questions/5043012/django-trim-whitespaces-from-charfield On Tuesday, 3 November 2015 16:31:26 UTC+2, DJ-Tom wrote: > > > It worked! Basically it was a one-liner as well :-) > > > -- You received this message because you are subscribed to the Google

Re: How to clean up character database fields with leading and trailing spaces

2015-11-03 Thread DJ-Tom
It worked! Basically it was a one-liner as well :-) -- 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

Re: How to clean up character database fields with leading and trailing spaces

2015-11-03 Thread DJ-Tom
Thanks Vijay, since this is a very small application, it uses sqlite 3 as the data backend... according to http://www.sqlite.org/lang_corefunc.html, there is a trim() function in sqlite... so I will check if this works. best Thomas Am Dienstag, 3. November 2015 14:02:52 UTC+1 schrieb Vijay Kh

Re: How to clean up character database fields with leading and trailing spaces

2015-11-03 Thread Vijay Khemlani
As far as I know the Django ORM encapsulates SQL queries, so you can't put arbitrary python code in there (".strip()") If I remember correctly SQL does not have a standard TRIM method, but individual database engines do, for example for Postgres http://www.postgresql.org/docs/9.1/static/functions

How to clean up character database fields with leading and trailing spaces

2015-11-03 Thread DJ-Tom
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 '