VeryApt / django-phone-field

Lightweight model and form field for phone numbers in Django
GNU General Public License v3.0
52 stars 13 forks source link

Get raw phone number as a string #18

Closed NChechulin closed 3 years ago

NChechulin commented 3 years ago

I suppose this question might sound a little stupid, but how do I get the string from PhoneField?

I have my model:

class User:
    ...
    phone_number = PhoneField()

And in my view I try to send the result back to the client, but I get a message that PhoneView is not JSON serializable.

NChechulin commented 3 years ago

As usual, as soon as I ask a question I find the answer. It's PhoneField.verbose_name().

I guess it would be cool if this would be added to the documentation...