Issue #13 new

field.attname vs.

created an issue

Line 174 of

value = getattr(item,

Using field.attname may be preferable to avoid following foreign key relationships. An extra keyword argument such as follow_foreign or something could be added.

Thanks for contributing; love the software.

Comments (5)

  1. Dane Springmeyer repo owner

    bekozi, good catch/call. I've only recently realized that field.attname exits, and yes I agree that would be better. Patch would be great, otherwise I'll try to fix and test when I have time.

  2. bekozi reporter

    Cool. Also need it to map Django field types to OGR field types correctly which I am working on. Will provide you the code when finished.

  3. bekozi reporter

    here are the modifications we made to the export module thusfar. the foreign key "problem" arises when the related model has a unicode representation. added some logic to pull the pk attribute in these cases. also put in a quick slice to ensure the field names do not exceed the shapefile limit (eventually, it would be nice to implement something to catch nonunique fields after truncation).

    a method called |map_ogr_types| was added at the end matching major django field types to ogr types. there is a loop inside to follow foreign keys to their related fields to find the correct field type. you may know of a shortcut here...and elsewhere!

  4. Log in to comment