Pre-sort objects in tables
This commit is contained in:
parent
384e5bc4ec
commit
20c410b5c4
1 changed files with 3 additions and 3 deletions
|
@ -10,13 +10,13 @@ def orgaString(context):
|
|||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def userDevices(context):
|
||||
return set(Device.objects.filter(organization__in=context.request.user.organization_set.all()))
|
||||
return sorted(set(Device.objects.filter(organization__in=context.request.user.organization_set.all())), key=lambda x: x.serial)
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def userWifis(context):
|
||||
return set(Wifi.objects.filter(organization__in=context.request.user.organization_set.all()))
|
||||
return sorted(set(Wifi.objects.filter(organization__in=context.request.user.organization_set.all())), key=lambda x: x.serial)
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def userUsers(context):
|
||||
return set(User.objects.filter(organization__in=context.request.user.organization_set.all()) if context.request.user.is_superuser else [])
|
||||
return sorted(set(User.objects.filter(organization__in=context.request.user.organization_set.all()) if context.request.user.is_superuser else []), key=lambda x: x.username)
|
||||
|
||||
|
|
Loading…
Reference in a new issue