Re: ordering integers with regroup

2010-06-11 Thread Euan Goddard
It should be easy enough to write your own tag providing you're expecting your input in the form . I've written a bit of code that should do this: import re LABEL_RE = re.compile(r'^(\w+) (\d+)$') def order_by_number(unordered_data): tokenized_data = [] for item in unordered_data:

Re: ordering integers with regroup

2010-06-09 Thread Nick
You are right, I wasn't even thinking about it like that. This is bad news as the information is coming across as "District 45" from another source and so I don't have just a district number to go off of. State government data is always terrible to work with. On Jun 9, 10:04 am, Scott Gould wrote

Re: ordering integers with regroup

2010-06-09 Thread Scott Gould
If you're ordering on "District 1", "District 2", etc. then the number is part of a string and will be sorted alphabetically. I image your only recourse will be to use the numeric field directly, and deal with prepending "District " to it in some other fashion. On Jun 9, 10:38 am, Nick wrote: > H

ordering integers with regroup

2010-06-09 Thread Nick
Has anyone come across an ordering issue with the regroup tag whereby if the field that is being ordered is an integer you get the following problem: say you have the grouped field "District" and the following groupings District 1 District 2 District 3 District 10 District 14 District 20 District