Commit f151eb3b authored by Lars Kruse's avatar Lars Kruse
Browse files

Add new filter "sort_gestalt_first"

This allows a list of accounts to start with a specific account (usually
the currently logged in user).
parent d3fcdd18
Pipeline #3100 passed with stages
in 6 minutes and 19 seconds
from django.template import Library
register = Library()
@register.filter
def sort_gestalt_first(gestalten, first_gestalt):
result = sorted(gestalten, key=lambda gestalt: gestalt.name.upper())
try:
result.remove(first_gestalt)
result.insert(0, first_gestalt)
except ValueError:
pass
return result
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment