Skip to content

Commit

Permalink
Added the information about the callbacks to the README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
zepich committed Apr 30, 2023
1 parent bfc1232 commit 688482f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,25 @@ class Form(MosparoForm):
mosparo = MosparoField(label='Spam protection', mosparo_uuid='123', mosparo_public_key='test_key', mosparo_private_key = 'private_key')
```

### Filter the field types and form data

The MosparoField offers some callback methods to adjust the behavior of the field.

```python
from mosparo_django.forms import MosparoForm
from mosparo_django.fields import MosparoField

class Form(MosparoForm):
# Your other fields...
mosparo = MosparoField(callback_ignored_field_types=None, callback_verifiable_field_types=None, callback_after_prepare_form_data=None)
```

| Argument name | Description |
|------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
| `callback_ignored_field_types` | Gets and returns a list of class names of field types, which should be ignored (Example: `PasswordInput`) |
| `callback_verifiable_field_types` | Gets and returns a list of class names of field types, which are verifiable (Example: `TextInput`) |
| `callback_after_prepare_form_data` | Gets the dict with all prepared form data, the required field names, and the verifiable field names as argument and expects the same to be returned. |

## License

mosparo Integration for Django is open-sourced software licensed under the [MIT License](https://opensource.org/licenses/MIT).
Expand Down

0 comments on commit 688482f

Please sign in to comment.