Permalink
Browse files

small changes to README

  • Loading branch information...
1 parent 52fa805 commit 7716a12180fd6bdfa68f9c1bf01f369176d8964c @toast38coza toast38coza committed Feb 2, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 README.mkd
View
@@ -96,20 +96,23 @@ You can then send a POST to:
You can also add you own custom methods to a ModelEndpoint. Adhoc methods in a ModelEndpoint observe the same rules as the get(), update() and delete() methods - with the noticable exception that self.pk _may_ not be set.
-For example, you could add a method called `about` that will list all the Categories available (not actually a good idea in real life):
+For example, you could add a method called `about` that will display some info about the Model or Record (just used for illustration: not actually a good idea in real life):
import ajax
from my_app.models import Category
class CategoryEndpoint(ajax.endpoints.ModelEndpoint):
+
+ ...
+
def about(self,request):
pk = self.pk
if pk:
return {"message" : "run an operation on record: %s"%self._get_record()}
else:
return {"message" : "run an operation on model: %s"%self.model.__name__}
-This would now be available at:
+Now, in addition to the endpoints above, this method would be available at:
* `/ajax/my_app/category/about.json` - would return "run an operation on model: ..."

0 comments on commit 7716a12

Please sign in to comment.