mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-20 06:56:18 -05:00
Do not need to fetch all archives when checking if domain has archives.
This commit is contained in:
parent
a8143d81b1
commit
17b3923747
1 changed files with 4 additions and 2 deletions
|
|
@ -93,8 +93,10 @@ class Archive(Base, ModelHelper):
|
|||
session.delete(self)
|
||||
|
||||
if self.domain:
|
||||
domain_archives = [i.id for i in self.domain.archives]
|
||||
if not domain_archives:
|
||||
# Delete a domain if it has no Archives.
|
||||
try:
|
||||
next(i.id for i in self.domain.archives)
|
||||
except StopIteration:
|
||||
self.domain.delete()
|
||||
|
||||
@property
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue