Browse files

Typos in the docs.

  • Loading branch information...
1 parent 91acbd9 commit 0a54c1367672898337a3e133a3ae8388156fb730 @jayd3e jayd3e committed Dec 7, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 docs/source/index.rst
View
4 docs/source/index.rst
@@ -150,7 +150,7 @@ While on the other hand, an association object uses a completely separate model,
self.object_id,
self.vote)
-For another example of a use of association objects, recently I made an app that is used for making Dota 2 guides. In this app, I had a number of users adding items from a list of about 125 into different sections of each guide. I used a an association object to create a relationship between my "guide" model and my "user" model each time someone dragged an item into a section of a guide. This got me to a point where I could see which items were added to which guide; however, I needed to see exactly which section of the guide the item was added to, so I add some metadata to the relationship. Putting a "section" field on the intermediary model allowed me to see exactly which section of the guide the user added the item to. I tend to always like to use association objects as opposed to many-to-many relationships, as it always gives me to add metadata to the relationship later on.
+For another example of a use of association objects, recently I made an app that is used for making Dota 2 guides. In this app, I had a number of users adding items from a list of about 125 into different sections of each guide. I used an association object to create a relationship between my "guide" model and my "user" model each time someone dragged an item into a section of a guide. This got me to a point where I could see which items were added to which guide; however, I needed to see exactly which section of the guide the item was added to, so I added some metadata to the relationship. Putting a "section" field on the intermediary model allowed me to see exactly which section of the guide the user added the item to. I tend to always use association objects as opposed to many-to-many relationships, as it gives me the option add metadata to the relationship later on.
Pyramid-Specific Stuff
@@ -286,6 +286,6 @@ This calls a javascript function called, appropriately, 'toggle_vote', which doe
});
};
-I'm sure their is an easier way to do some of these things with some jQuery magic unknown to me, but essentially what it does, is it first sends a AJAX GET request to the 'toggle_vote' view that we talked about previously. Then according to the status string, it changes the up/down arrows to either be inactive or active, which translates to either being of the 'active' class or not. Lastly it takes the current score of the object(the sum of all of its votes) and updates the part of the interface that displays the score. I decided on going with this method, as it ensures an updated value of the score; however, this also means that if a user votes on something at the same time as another user, one of them will see the score go up by two, which is not a desired outcome and might confuse people, so something to keep in mind. So that's that. The full process of adding social voting to your site.
+I'm sure there is an easier way to do some of these things with some jQuery magic unknown to me, but essentially what it does, is it first sends a AJAX GET request to the 'toggle_vote' view that we talked about previously. Then according to the status string, it changes the up/down arrows to either be inactive or active, which translates to either being of the 'active' class or not. Lastly it takes the current score of the object(the sum of all of its votes) and updates the part of the interface that displays the score. I decided on going with this method, as it ensures an updated value of the score; however, this also means that if a user votes on something at the same time as another user, one of them will see the score go up by two, which is not a desired outcome and might confuse people, so something to keep in mind. So that's that. The full process of adding social voting to your site.
**Note On Security: This demo is not exactly secure, because we can't verify that a request is coming from the user specified as the 'user_id'. So to improve this example, we could add a CSRF check or something to verify that it truly is the user voting on an object. That could be for another day.

0 comments on commit 0a54c13

Please sign in to comment.