[Backport] Fixing the ordering for the contacts endpoint in the users API

remotes/origin/enhancement/email-actions
Alejandro Alonso 2015-06-03 08:34:12 +02:00
parent 29b75dc78a
commit ae4786825e
1 changed files with 3 additions and 2 deletions

View File

@ -17,7 +17,7 @@
import uuid
from django.apps import apps
from django.db.models import Q
from django.db.models import Q, F
from django.utils.translation import ugettext as _
from django.core.validators import validate_email
from django.core.exceptions import ValidationError
@ -97,7 +97,8 @@ class UsersViewSet(ModelCrudViewSet):
self.check_permissions(request, 'contacts', user)
self.object_list = user_filters.ContactsFilterBackend().filter_queryset(
user, request, self.get_queryset(), self)
user, request, self.get_queryset(), self).extra(
select={"complete_user_name":"concat(full_name, username)"}).order_by("complete_user_name")
page = self.paginate_queryset(self.object_list)
if page is not None: