Skip to content

Commit

Permalink
feat: added generatedfield to supported types
Browse files Browse the repository at this point in the history
  • Loading branch information
yarimiz committed Oct 23, 2024
1 parent b8914f0 commit 0d50628
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/unfold/contrib/filters/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
FloatField,
IntegerField,
)
from django.db.models.fields.generated import GeneratedField
from django.forms import ValidationError
from django.http import HttpRequest
from django.utils.dateparse import parse_datetime
Expand Down Expand Up @@ -341,7 +342,9 @@ def __init__(
field_path: str,
) -> None:
super().__init__(field, request, params, model, model_admin, field_path)
if not isinstance(field, (DecimalField, IntegerField, FloatField, AutoField)):
if not isinstance(
field, (DecimalField, IntegerField, FloatField, AutoField, GeneratedField)
):
raise TypeError(
f"Class {type(self.field)} is not supported for {self.__class__.__name__}."
)
Expand Down

0 comments on commit 0d50628

Please sign in to comment.