vandersonmota/model_mommy — pull request #124 by CharString (2013-09-18 02:01:28+00:00)
Title: Feature/custom field value generation api #90

Started some code on a feature branch. Needs more work and discussion.
Doing a pull_request for further discussion following #90.

Not sure about the decorators. They don't really make sense, as we aren't really wrapping the fields.
```python
def gen_func():
return "random_value"

class CustomField(models.Fields):
... #some field code

add_value_generator(gen_func, CustomField)
```
Is the same LOC. But make more sense semantically, than

```python
def gen_func():
return "random_value"

@custom_field_gen("gen_func")
class CustomField(models.Fields):
... #some field code
```

I do still see a usecase for the context_manager as it is better at handling exception cases than a `single_use` parameter would.

And what about a model_field param? When I did the model param, I thought, about a model using the same CustomField multiple times for different model_fields. But when implementing that, I felt like I was redoing stuff, that can already be done pretty well with recipes.