diff --git a/base_requirements.txt b/base_requirements.txt index 40e0224e2..432301267 100644 --- a/base_requirements.txt +++ b/base_requirements.txt @@ -121,8 +121,8 @@ netaddr Pillow # PostgreSQL database adapter for Python -# https://www.psycopg.org/docs/news.html -psycopg2-binary +# https://github.com/psycopg/psycopg2/blob/master/NEWS +psycopg-binary # YAML rendering library # https://github.com/yaml/pyyaml/blob/master/CHANGES diff --git a/netbox/core/models/data.py b/netbox/core/models/data.py index 2af697f60..a2a20f858 100644 --- a/netbox/core/models/data.py +++ b/netbox/core/models/data.py @@ -290,8 +290,10 @@ class DataFile(models.Model): @property def data_as_string(self): + if not self.data: + return None try: - return self.data.tobytes().decode('utf-8') + return bytes(self.data, 'utf-8') except UnicodeDecodeError: return None diff --git a/netbox/extras/models/tags.py b/netbox/extras/models/tags.py index 066c0fd78..31128ad54 100644 --- a/netbox/extras/models/tags.py +++ b/netbox/extras/models/tags.py @@ -61,6 +61,4 @@ class TaggedItem(GenericTaggedItemBase): ) class Meta: - index_together = ( - ("content_type", "object_id") - ) + indexes = [models.Index(fields=["content_type", "object_id"])] diff --git a/requirements.txt b/requirements.txt index ee6a79635..a39803113 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ bleach==6.0.0 boto3==1.26.145 -Django==4.1.9 +Django==4.2.2 django-cors-headers==4.0.0 django-debug-toolbar==4.1.0 django-filter==23.2 @@ -27,7 +27,9 @@ mkdocs-material==9.1.15 mkdocstrings[python-legacy]==0.22.0 netaddr==0.8.0 Pillow==9.5.0 -psycopg2-binary==2.9.6 +psycopg==3.1.9 +psycopg-binary==3.1.9 +psycopg-pool==3.1.7 PyYAML==6.0 sentry-sdk==1.25.0 social-auth-app-django==5.2.0