django-geojson icon indicating copy to clipboard operation
django-geojson copied to clipboard

Unable to serialize database: __init__() got an unexpected keyword argument 'use_natural_foreign_keys'

Open thecristen opened this issue 9 years ago • 4 comments

Trying to use the serializer to make use of python manage.py dumpdata --format=geojson find_my_place.County > find_my_place/data/counties.geojson

I have 'djgeojson' in my apps, and i have

SERIALIZATION_MODULES = {
    'geojson' : 'djgeojson.serializers'
}

Django 1.8.7, Python 2.7.10...

thecristen avatar Nov 26 '15 02:11 thecristen

Thanks for reporting!

Does it work without the --format argument? I mean, with default json format?

leplatrem avatar Nov 26 '15 09:11 leplatrem

I have the same issue and similar configuration. In settings.py I have

SERIALIZATION_MODULES = {
    'geojson': 'djgeojson.serializers'
}

Django 1.8.4, Python 2.7.6. Omitting the --format argument successfully produces a json file, but QGIS doesn't recognize it even with a geojson extension.

dennereed avatar Dec 14 '15 23:12 dennereed

Don't hesitate to dig in yourself and submit a fix via a pull-request. I cannot spend time on this :(

Actually I don't use this project anymore, and it looks like makinacorpus is still running Django 1.6

leplatrem avatar Dec 15 '15 08:12 leplatrem

First of all, Django>=1.8 comes with the built in GeoJSON serializer, so most probably you don't need to use djgeojson at all. What about __init__() got an unexpected keyword argument 'use_natural_foreign_keys' error, the reason is that use_natural_keys option deprecated since Django 1.7 and another new ones introduced: use_natural_foreign_keys and use_natural_primary_keys.

sikmir avatar Jan 05 '18 14:01 sikmir