From: Michael Tremer Date: Fri, 27 Feb 2026 11:41:49 +0000 (+0000) Subject: sources: Make them sortable X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5125046dc836878833771909b65d2eb4c00a0409;p=dbl.git sources: Make them sortable Signed-off-by: Michael Tremer --- diff --git a/src/dbl/sources.py b/src/dbl/sources.py index b6d09f2..199c771 100644 --- a/src/dbl/sources.py +++ b/src/dbl/sources.py @@ -106,6 +106,12 @@ class Source(sqlmodel.SQLModel, database.BackendMixin, table=True): def __len__(self): return self.total_domains or 0 + def __lt__(self, other): + if isinstance(other, self.__class__): + return self.name < other.name + + return NotImplemented + def __hash__(self): # Only hashable once the object has an ID if self.id is None: