Sibyx / django_api_forms

Declarative Django request validation for RESTful APIs

Home Page:https://sibyx.github.io/django_api_forms/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Population strategies

Sibyx opened this issue · comments

Is your feature request related to a problem? Please describe.

I need to override default behaviour for specific form fields in Form.fill method

Describe the solution you'd like

I would like to introduce field fill strategies, which could be overrided like this:

DJANGO_API_FORMS = {
    'FILL_STRATEGIES': {
        'django.forms.CharField': 'apps.api.forms.strategies.CharFieldStrategy',
        'django.forms.ModelMultipleChoiceField': 'django_api_forms.strategies.ModelMultipleChoiceFieldReplaceStrategy',
        'apps.api.forms.fields.LocalisationField': 'apps.api.forms.strategies.LocalisationStrategy'
    }
}

Resolved in #30