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

Update modelfields.py to address Issue #123 #124

Closed
wants to merge 2 commits into from

Conversation

dedayoa
Copy link

@dedayoa dedayoa commented Apr 22, 2016

The patch to get_prep_value() allows manage.py migrate to successfully complete. This is to address issue "Running migration on phonenumberfield results in AttributeError #123"

As per https://docs.djangoproject.com/en/1.8/howto/custom-model-fields/#custom-field-deconstruct-method, I also added the deconstruct method. I don't know if my migration will run without this, but figure since it's required, it should stay.

The patch to get_prep_value() allows manage.py migrate to successfully complete. This is to address issue "Running migration on phonenumberfield results in AttributeError stefanfoulis#123"

As per https://docs.djangoproject.com/en/1.8/howto/custom-model-fields/#custom-field-deconstruct-method, I also added the deconstruct method. I don't know if my migration will run without this, but figure since it's required, it should stay.
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 608b028 on dedayoa:develop into * on stefanfoulis:develop*.

@@ -73,6 +73,10 @@ def get_prep_value(self, value):
return value
format_string = getattr(settings, 'PHONENUMBER_DB_FORMAT', 'E164')
fmt = PhoneNumber.format_map[format_string]

if value is None:
return ''
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if a field has null=True? Shouldn't it return None then?

@amateja
Copy link
Collaborator

amateja commented May 6, 2016

Hi @dedayoa,

I cannot refer to your problem not having a piece of your code. I've already commented your changes and I'm not very convinced to your PR. Are you sure that it is not a bug in your application? Recently we have changed get_prep_value method to respect null=True option in #102 and it appears to me like an aftermath.

@amateja amateja closed this Jun 3, 2016
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

Successfully merging this pull request may close these issues.

None yet

3 participants