how to use custom provider in Field object #1086
-
Hey! at first thanks for your amazing package it helps me a lot.i should give my custom provider to Field object but i get unsupported field error how i can pass this problem. can i pass Generic with some custom provider to Field object ? something like this: class Custom(BaseProvider):
class Meta:
name = 'custom'
#some method
generic = Generic(locale=en)
generic.add_provider(Custom)
_ = Field(locale=en)
desc = (lambda: {'custom': _('custom.some_method', generic_class=generic)})
schema = Schema(schema=desc) |
Beta Was this translation helpful? Give feedback.
Answered by
lk-geimfari
Sep 8, 2021
Replies: 1 comment 1 reply
-
You can pass a sequence (list, tuple, etc.) of the custom providers: https://mimesis.name/api.html#field Like this: class Custom(BaseProvider):
class Meta:
name = 'custom'
_ = Field(locale=en, providers=[Custom])
desc = (lambda: {'custom': _('custom.some_method', generic_class=generic)})
schema = Schema(schema=desc) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ilia4bit
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can pass a sequence (list, tuple, etc.) of the custom providers: https://mimesis.name/api.html#field
Like this: