berinhard / model_mommy

No longer maintained, please migrate to model_bakery
http://model-bakery.readthedocs.org/
Other
903 stars 141 forks source link

How do you deal with phone number fields? #152

Closed mark0978 closed 10 years ago

mark0978 commented 10 years ago

Specifically these phone # fields: https://github.com/stefanfoulis/django-phonenumber-field

Right now I'm throwing lots of these errors, since I converted my phone # fields to this (to make integration with twilio easier?) TypeError: <class 'phonenumber_field.modelfields.PhoneNumberField'> is not supported by mommy.

vandersonmota commented 10 years ago

You'll have to define a function to generate values to this type of field. more info here: https://github.com/vandersonmota/model_mommy#custom-fields

mark0978 commented 10 years ago

Awesome, works like a champ!

I'm wondering your thoughts on applying this kind of idea to https://github.com/vandersonmota/model_mommy/issues/144

Would it be possible to have a "stack" of these kind of definitions that could be used to implement the "with" idea?

vandersonmota commented 10 years ago

For now, i don't wish to define generation rules for custom fields with context managers, in order to not to bloat the api =)