-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Fixes PostGIS model registration #67
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🏅
@@ -143,7 +143,7 @@ def get_type_mapping(): | |||
|
|||
mapping = default_mapping.copy() | |||
mapping[ContentType] = random_gen.gen_content_type | |||
default_mapping.update(default_gis_mapping) | |||
mapping.update(default_gis_mapping) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ thanks for catching this!!!
@@ -143,7 +143,7 @@ def get_type_mapping(): | |||
|
|||
mapping = default_mapping.copy() | |||
mapping[ContentType] = random_gen.gen_content_type | |||
default_mapping.update(default_gis_mapping) | |||
mapping.update(default_gis_mapping) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ thanks for catching this!!!
I'm merging this since 2/3 maintainers have approved it 👍 |
@anapaulagomes and @amureki what do you think about a new release adding this PR? |
@berinhard sure, why not? If possible, we should try to add a regression test for this case to not break it in the future again. |
The result of
generators.get_type_mapping()
is being used when registering types inbaker.init_type_mapping
, but the return value ofget_type_mapping
is being set to the copied value of the mappings before postgis models have been added. This leads model baker to believe that the PostGis models are invalid, when in fact, they are valid.Given this model in
myapp/models.py
...The code below errors when executed in the Django shell:
with the following error:
TypeError: <class 'django.contrib.gis.db.models.fields.PointField'> is not supported by baker.
I've tested this change locally, and it works, but I'm not sure why this is not being picked up in the tests on TravisCI