﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
20105	dictsort by obj and by obj_id gives varying results	apollovy@…	nobody	"Hello there.

Story:

I've got a model:
{{{
class MyModel(Model):
 obj = ForeignKey(SomeOtherModel)
}}}

I've got a view:
{{{
class MyView(ListView):
 def get_context_data(self):
  return {'objects': MyModel.objects.all()}
}}}

Then I've got a template:
{{{
{% regroup objects|dictsort:'obj_id' by obj %}
{% regroup objects|dictsort:'obj' by obj %}
}}}

And I've got data:
{{{
MyModel: [{id: 1, obj: 1},{id: 2, obj: 1},{id: 3, obj: 2},{id: 4, obj: 2},{id: 5, obj: 1}]
SomeOtherModel: [{id: 1},{id: 2}]
}}}

Dictsort in first case works well and predictable.
Second case - no way to figure out. One time objects got grouped in 2 groups, as expected. The other time - in 3 groups. The other time - in 4(!) groups.


Guess this behaviour is not meant.
"	Uncategorized	closed	Template system	1.5	Normal	invalid	dictsort,sorting,grouping,regroup,templatetag	bmispelon@…	Unreviewed	0	0	0	0	0	0
