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

Problem serializing a model class with a foreign field #23

Open
jorgeas80 opened this issue Apr 8, 2014 · 2 comments
Open

Problem serializing a model class with a foreign field #23

jorgeas80 opened this issue Apr 8, 2014 · 2 comments
Labels

Comments

@jorgeas80
Copy link

Hello,

I'm struggling with a problem using this plugin, serializing to GeoJSON a simple model class (call it A) with a Polygon.

The problem is another model class (call it B) contains a foreign key to A, and the serializer throws an error, because it tries to find one of the B fields in A. Of course, it isn't found.

May it be a bug on the serializer?

Extended information about the problem here

@leplatrem
Copy link
Collaborator

It looks like a bug indeed.
You can try (temporarly) to specify explicitly the list of properties fields.

@leplatrem leplatrem added bug and removed bug labels Apr 8, 2014
@jorgeas80
Copy link
Author

Thanks for your response. I finally could solve it by preventing Django to create backwards relation between ROI and Series.

class Series(gismodels.Model): # Prevents django to create a backwards relation between ROI and Series roi = models.ForeignKey(ROI, related_name='+') indicator = models.ForeignKey(Indicator)

I hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants