MikeN
MikeN

Reputation: 46287

Django queryset to find a char value with filtered out spaces?

There are database string values that are sometimes stored with unnecessary spaces: "SDF@#$#@ 132423"

Given the value without spaces in the UI of a program: "SDF@#$#@132423"

How could I do a Django queryset filter to find the Database value (with spaces) from the UI input value sans spaces?

Upvotes: 1

Views: 255

Answers (1)

Pierre-Jean Coudert
Pierre-Jean Coudert

Reputation: 9347

A way is to add another field to your model to store "cleaned" values. Next you only have to search for the "cleaned" user entry in this field.

Upvotes: 3

Related Questions