Skip to content

Commit

Permalink
Make EventQuerySet Generic (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
max-muoto authored Oct 1, 2024
1 parent 87f1c05 commit a035c96
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pghistory/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import uuid
import warnings
from typing import TYPE_CHECKING, TypeVar

import django
from django.apps import apps
Expand All @@ -11,6 +12,8 @@

from pghistory import core, utils

_M = TypeVar("_M", bound=models.Model)

# This class is to preserve backwards compatibility with migrations
PGHistoryJSONField = utils.JSONField

Expand Down Expand Up @@ -129,7 +132,13 @@ def get_compiler(self, *args, **kwargs):
return compiler


class EventQuerySet(models.QuerySet):
if TYPE_CHECKING:
_EventQuerySetBase = models.QuerySet[_M]
else:
_EventQuerySetBase = models.QuerySet


class EventQuerySet(_EventQuerySetBase):
"""QuerySet with support for proxy fields"""

def __init__(self, model=None, query=None, using=None, hints=None):
Expand Down

0 comments on commit a035c96

Please sign in to comment.