Skip to content

Commit d9b0951

Browse files
committed
feat: improve documentation on concatenation of different field types, closes #60
1 parent e1c2cd1 commit d9b0951

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
88
## [Unreleased]
99
-->
1010

11+
## [Unreleased]
12+
13+
### Changed
14+
- Improved documentation on concatenation of different field types.
15+
1116
## [3.0.0] - 2024-09-10
1217
### Breaking
1318
- Removed `SCRUBBER_VALIDATION_WHITELIST` in favour of `SCRUBBER_REQUIRED_FIELD_MODEL_WHITELIST` - Thanks @GitRon

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,13 @@ class Scrubbers:
144144
Wrapper around `django.db.functions.Concat` to enable simple concatenation of scrubbers. This is useful if you want to
145145
ensure a fields uniqueness through composition of, for instance, the `Hash` and `Faker` (see below) scrubbers.
146146

147+
When using different input field types, make sure to explicitly state an `output_field` type.
148+
147149
The following will generate random email addresses by hashing the user-part and using `faker` for the domain part:
148150

149151
```python
150152
class Scrubbers:
151-
email = scrubbers.Concat(scrubbers.Hash('email'), models.Value('@'), scrubbers.Faker('domain_name'))
153+
email = scrubbers.Concat(scrubbers.Hash('email'), models.Value('@'), scrubbers.Faker('domain_name'), output_field=models.EmailField())
152154
```
153155

154156
### Faker

0 commit comments

Comments
 (0)