Skip to content

Commit

Permalink
Merge pull request #3027 from richid/system-pg-version-fix
Browse files Browse the repository at this point in the history
bug: Fix decimal.InvalidOperation on /system for some PG versions
  • Loading branch information
vabene1111 authored Mar 9, 2024
2 parents aebc4a4 + 3489216 commit 2264050
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions cookbook/views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,10 @@ def system(request):

if postgres:
postgres_current = 16 # will need to be updated as PostgreSQL releases new major versions
from decimal import Decimal

from django.db import connection

postgres_ver = Decimal(str(connection.pg_version).replace('00', '.'))
postgres_ver = divmod(connection.pg_version, 10000)
if postgres_ver >= postgres_current:
database_status = 'success'
database_message = _('Everything is fine!')
Expand Down

0 comments on commit 2264050

Please sign in to comment.