Closed ethel-t-frog closed 7 years ago
I assume this is for storing which challenges the story has won.
It's specifically for the story view to do a reverse lookup of the challenge the story won. I have a tag that conditionally displays the challenge information in the story's sidebar and I also use it to display the glyphicon that appears at the end of the story's title.
You don't need additional fields to do reverse lookups, and why is it floating point?
Yeah, I realized this morning after you brought this up that I can think of a better way to handle this by calling the challenge object and pulling the winning story ID from there. The floating point thing was an oversight on my part. It should have been an integer. Let me go back over the code and make some changes. I'll drop that field off the Story table and update all the reverse lookups.
I tweaked your Challenges code a bit to make better use of internal object representations and removed this field in the process. I'll merge your pull request soon (as it conflicts with mine).
I looked at your commit. That's definitely better than what I was trying to do.
I'm still figuring out models and everything you can do with them aside from just creating databases. :)
No worries, Jim. It takes a bit of time to work it all out. It's all part of the Scout Method: "learn by doing".
http://members.scouts.org.uk/supportresources/957/scout-method
That's the way I learn best, honestly -- jump in with both feet and splash around until things make sense. I liked what you did with the model to simple things up, so I'll keep that in mind for the future and see if I can't bone up some more on just exactly how models work. The Django documentation is, of course, unpleasantly opaque most of the time, so reading that hasn't been nearly as helpful as I hoped it'd be.
I also went ahead and resolved the merge issues and committed a couple of minor lingering error fixes from my side, so that should be all set and ready for you to pull at your leisure.
Jim,
what is this new field for in Story?