Is there a way to cast some unknown types to Ninja? I noticed that list is limited to what's inside TYPES defined at ninja/orm/fields.py:40. I have a custom field made on top of ArrayField (Postgres) which is essentially a comma delimited string.
I have a TimeField defined on a model and would like to change the format, to drop seconds from it. How this could be done?
One more
I'm using Hashids for my ID, and this snippets works properly, but I'm not sure I'm doing it right because validator doesn't make sense for me when I want to present a value. Is there a better way to do it?
class OrderOut(ModelSchema):
id: str
class Config:
model = models.Order
model_fields = ("name",)
@validator("id", pre=True, allow_reuse=True, check_fields=False)
def hashid(cls, v):
return v.hashid
I'm using hashid as a primary key field:
id = HashidAutoField(primary_key=True)
Hey, I got two more questions:
One more
I'm using Hashids for my ID, and this snippets works properly, but I'm not sure I'm doing it right because validator doesn't make sense for me when I want to present a value. Is there a better way to do it?
I'm using hashid as a primary key field:
id = HashidAutoField(primary_key=True)