]> git.ipfire.org Git - dbl.git/commitdiff
sources: Make them sortable
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 27 Feb 2026 11:41:49 +0000 (11:41 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 27 Feb 2026 11:41:49 +0000 (11:41 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/dbl/sources.py

index b6d09f2fb91659a34ff6430f86e9ae024f545b28..199c771b1c0b86749dabfb4e90bf9be0938d0835 100644 (file)
@@ -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: