-
Notifications
You must be signed in to change notification settings - Fork 3
Place Model #1
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
base: master
Are you sure you want to change the base?
Place Model #1
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.
should this be nullable too? It seems like the coordinate is the most important aspect, but from a practical workflow perspective, sometimes you may only have an address and you'd like to do the geolocation out-of-band, and making coordinate required limits how you can do that.
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.
The one essential piece of info a place should have is that it is located somewhere. That is what my thought was. Also previously I've had problems with geospatial queries in Postgres when the fields are null. This may not be the case anymore, but I've always avoided nullable point fields since then especially since it is the most important field in the model.
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.
I think having a required PointField on a Place is a fair requirement.
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.
on a philosophical django tangent... we've had the idea of enforcing different levels of data validation. Like an unpublished article doesn't need a slug, but a published one does, so should the slugfield be required? As I typed that out... I think the answer is yes. before the save() hits, you should just pre-generate one, even if it's gibberish. Likewise here, we can assume the implementer has figured out how to get the latlong already, or decides to use a dummy latlong and then fills in the real one later (like how Google maps used to default to the geographic center of the continental US).
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.
When I implemented the model on the front end I have a button that the user clicks to look up an address on google maps and fills in the coordinates. Originally, I wanted to include this functionality with the Armstrong contribution by using http://mapstraction.com/. Mapstraction would allow you to switch between map providers. However, I never got it to work right and had to finish with a quick implementation of just google maps in the client's code. Now that I have sometime, I could probably revisit it if you think it is appropriate to include with the contribution.
|
What about taking the model a step further and making relationships for |
|
Definitely a good idea and makes the model more robust. Is probably Then you could do geospatial queries on zip codes too. On Fri, Aug 24, 2012 at 9:34 AM, Travis Swicegood
Paul Bailey |
Added a simple place model. It is not a lot but gives a good start for users needing location based content.