field.attname vs.

bekozi avatarbekozi 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

    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

    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

    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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.