Skip to content

Commit

Permalink
announce field type through get_internal_type method
Browse files Browse the repository at this point in the history
Helps drf-spectacular to infer the type for generating OpenAPI schema.
  • Loading branch information
w00kie authored Aug 16, 2024
1 parent 700372d commit ed1914d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions django_sqids/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ def get_sqid_instance(self):
)
return Sqids(min_length=min_length, alphabet=alphabet)

def get_internal_type(self):
return "CharField"

def get_prep_value(self, value):
if self.prefix:
if value.startswith(self.prefix):
Expand Down

0 comments on commit ed1914d

Please sign in to comment.