mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-14 13:10:12 +02:00
cleanup
This commit is contained in:
@@ -8,7 +8,7 @@ from django.conf import settings
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.mixins import UserPassesTestMixin
|
||||
from django.core.cache import cache
|
||||
from django.db import ProgrammingError, connection
|
||||
from django.db import DatabaseError, connection
|
||||
from django.http import Http404, HttpResponse, HttpResponseForbidden
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.urls import reverse
|
||||
@@ -672,9 +672,9 @@ class SystemView(UserPassesTestMixin, View):
|
||||
psql_version = psql_version.split('(')[0].strip()
|
||||
cursor.execute("SELECT current_database()")
|
||||
db_name = cursor.fetchone()[0]
|
||||
cursor.execute(f"SELECT pg_size_pretty(pg_database_size('{db_name}'))")
|
||||
cursor.execute("SELECT pg_size_pretty(pg_database_size(current_database()))")
|
||||
db_size = cursor.fetchone()[0]
|
||||
except (ProgrammingError, IndexError):
|
||||
except (DatabaseError, IndexError):
|
||||
pass
|
||||
return {
|
||||
'netbox_release': settings.RELEASE,
|
||||
@@ -731,7 +731,7 @@ class SystemView(UserPassesTestMixin, View):
|
||||
'columns': columns_by_table[table_name],
|
||||
'indexes': indexes_by_table.get(table_name, []),
|
||||
})
|
||||
except ProgrammingError:
|
||||
except DatabaseError:
|
||||
pass
|
||||
return db_schema
|
||||
|
||||
|
||||
Reference in New Issue
Block a user