Wiadomość napisana w dniu 2008-11-07, o godz. 14:54, przez Thomas Guettler:
> I just discovered, that you can't sort a list of model instances. > > This failed with AssertionError: > > view_groups=sorted([brg.group for brg in ... ]) > change_groups=sorted([...]) > if view_groups==change_groups: > ... > else: > assert set(view_groups)!=set(change_groups), (view_groups, > change_groups) I always sort lists of model instances using sort(key=operator.attrgetter...) idiom (this sorts item in place and does not return a copy) and never saw such problems. -- We read Knuth so you don't have to. - Tim Peters Jarek Zgoda, R&D, Redefine [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---