core: revert django update (#5236)
* Revert "core: bump django from 4.1.7 to 4.2 (#5151)"
This reverts commit 18a4eac527.
* run unittests with postgres 11 and 12
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
---------
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
			
			
This commit is contained in:
		@ -1,21 +0,0 @@
 | 
			
		||||
"""Database engine that uses prometheus exporter"""
 | 
			
		||||
from django.db.backends.postgresql import base
 | 
			
		||||
from django_prometheus.db.common import DatabaseWrapperMixin, ExportingCursorWrapper
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class DatabaseFeatures(base.DatabaseFeatures):
 | 
			
		||||
    """Our database has the exact same features as the base one."""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class DatabaseWrapper(DatabaseWrapperMixin, base.DatabaseWrapper):
 | 
			
		||||
    """Database wrapper which exports metrics to prometheus"""
 | 
			
		||||
 | 
			
		||||
    def get_connection_params(self):
 | 
			
		||||
        conn_params = super().get_connection_params()
 | 
			
		||||
        conn_params["cursor_factory"] = ExportingCursorWrapper(base.Cursor, self.alias, self.vendor)
 | 
			
		||||
        return conn_params
 | 
			
		||||
 | 
			
		||||
    def create_cursor(self, name=None):
 | 
			
		||||
        # cursor_factory is a kwarg to connect() so restore create_cursor()'s
 | 
			
		||||
        # default behavior
 | 
			
		||||
        return base.DatabaseWrapper.create_cursor(self, name=name)
 | 
			
		||||
@ -270,7 +270,7 @@ CHANNEL_LAYERS = {
 | 
			
		||||
 | 
			
		||||
DATABASES = {
 | 
			
		||||
    "default": {
 | 
			
		||||
        "ENGINE": "authentik.root.db_engine",
 | 
			
		||||
        "ENGINE": "django_prometheus.db.backends.postgresql",
 | 
			
		||||
        "HOST": CONFIG.y("postgresql.host"),
 | 
			
		||||
        "NAME": CONFIG.y("postgresql.name"),
 | 
			
		||||
        "USER": CONFIG.y("postgresql.user"),
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user