Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behavior when used with ArrayField #203

Open
angelkenneth opened this issue Feb 21, 2018 · 2 comments
Open

Unexpected behavior when used with ArrayField #203

angelkenneth opened this issue Feb 21, 2018 · 2 comments

Comments

@angelkenneth
Copy link

Provided we have the model:

from django.contrib.postgres.fields import ArrayField
from django.db.models import Model
from phonenumber_field.modelfields import PhoneNumberField

class Foo(Model):
    contact = PhoneNumberField()
    contacts = ArrayField(PhoneNumberField(), default=list)

Then run the following:

Foo.objects.create(contact="+639171234567", contacts=["+639171234567"])
foo = Foo.objects.get()

Accessing the variables, one could expect the following:

foo.contact
>>> PhoneNumber(country_code=63, national_number=9171234567, ...)
foo.contacts
>>> [ PhoneNumber(country_code=63, national_number=9171234567, ...) ]

However, foo.contacts returns a list of strings:

foo.contact
>>> PhoneNumber(country_code=63, national_number=9171234567, ...)
foo.contacts
>>> ['+639171234567']
@stefanfoulis
Copy link
Owner

@gheloace thanks for reporting this

@francoisfreitag
Copy link
Collaborator

Reproduced this issue with django-phonenumber-field 7.0.0 and Django 4.1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants