Make organisations natively sortable

This commit is contained in:
Chris Hill-Scott
2021-11-11 14:35:55 +00:00
parent 18dfc44899
commit 0c2b586e40
6 changed files with 45 additions and 21 deletions

View File

@@ -2,7 +2,7 @@ from flask import abort, current_app
from notifications_utils.serialised_model import SerialisedModelCollection
from werkzeug.utils import cached_property
from app.models import JSONModel
from app.models import JSONModel, SortByNameMixin
from app.models.contact_list import ContactLists
from app.models.job import (
ImmediateJobs,
@@ -27,7 +27,7 @@ from app.notify_client.template_folder_api_client import (
from app.utils import get_default_sms_sender
class Service(JSONModel):
class Service(JSONModel, SortByNameMixin):
ALLOWED_PROPERTIES = {
'active',
@@ -78,9 +78,6 @@ class Service(JSONModel):
def from_id(cls, service_id):
return cls(service_api_client.get_service(service_id)['data'])
def __lt__(self, other):
return self.name.lower() < other.name.lower()
@property
def permissions(self):
return self._dict.get('permissions', self.TEMPLATE_TYPES)