]> git.parisson.com Git - teleforma.git/commitdiff
fix utf8 for user filtering
authorGuillaume Pellerin <yomguy@parisson.com>
Tue, 17 Apr 2012 11:10:27 +0000 (13:10 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Tue, 17 Apr 2012 11:10:27 +0000 (13:10 +0200)
teleforma/models.py
teleforma/views.py

index 00ef751de0847beb2cb7fa6128c0ac37ab379d8d..87c3d0e8b0f59bc007cc32ad2e56de80b0c8ad91 100755 (executable)
@@ -415,8 +415,8 @@ class NamePaginator(object):
         chunks = {}
         
         for obj in self.object_list:
-            if on: obj_str = str(getattr(obj, on))
-            else: obj_str = str(obj)
+            if on: obj_str = getattr(obj, on).encode('utf8')
+            else: obj_str = obj.encode('utf8')
             
             letter = str.upper(obj_str[0])
             
index c8cb46d4c1c0857c87dbd99bedda4ff2e33d4dea..194a1cc3454528943d1ded95c880c4ee45d4366d 100755 (executable)
@@ -166,7 +166,7 @@ class UsersView(ListView):
         context = super(UsersView, self).get_context_data(**kwargs)
         context['trainings'] = Training.objects.all()
         context['all_users'] = User.objects.all()
-        paginator = NamePaginator(self.object_list, on="username", per_page=12)
+        paginator = NamePaginator(self.object_list, on="last_name", per_page=12)
         try:
             page = int(self.request.GET.get('page', '1'))
         except ValueError: