Improve database queries
This commit is contained in:
@@ -22,7 +22,7 @@ def cleanup_expired(app, start_time=None):
|
||||
now = now_utc()
|
||||
expired_count = 0
|
||||
|
||||
for hostname in Hostname.select().join(User).where(
|
||||
for hostname in Hostname.select(Hostname, User.email).join(User).where(
|
||||
(Hostname.expiry_ttl != 0) &
|
||||
((Hostname.last_ipv4.is_null(False) & Hostname.last_ipv4_update.is_null(False)) |
|
||||
(Hostname.last_ipv6.is_null(False) & Hostname.last_ipv6_update.is_null(False)))):
|
||||
|
||||
@@ -134,7 +134,7 @@ def cmd_user_email(args, app):
|
||||
|
||||
def cmd_hostname_list(args, app):
|
||||
"""List hostnames."""
|
||||
query = Hostname.select().join(User)
|
||||
query = Hostname.select(Hostname, User.username).join(User)
|
||||
|
||||
if args.user:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user