On Fri, Apr 27, 2012 at 11:02 AM, Tom Evans <[email protected]>wrote:
> On Thu, Apr 26, 2012 at 4:20 PM, Sherif Shehab Aldin > <[email protected]> wrote: > > Hi All, > > > > I am developing some django apps, mostly they are adds to the django > admin > > interface... What I need to do a lot is adding some Ajax calls, but I am > a > > bit confused about weather It's better to provide those Ajax calls as web > > services like SOAP or REST, or I just create normal views.. I need to > > standardize those calls, I want to have a pattern to follow whenever I > need > > to create new Ajax call to minimize the time needed to add new > functionality > > and focus on the function Itself, cause currently every time I want to > add a > > new call, I keep asking myself this question, and It confuses me a lot. > > > > Also I want to ask weather REST is only used to get,post, put and object > or > > It can be just like a way to do RPC? cause most of examples for REST are > > just focusing on get/post an object. > > > > Your thoughts are highly appreciated. :-) > > > > Regards, > > Sherif. > > > > It's not typical to use SOAP for AJAX calls, in fact I don't think > I've ever seen that. TBH, it's not typical to use SOAP at all unless > you are in the thrall of a tool manufacturer. > > What you said is really interesting, as I am not very familiar with web services in general and don't have a good view of when which one should be used. > REST is all about objects, but this doesn't mean that you cannot do > RPC with REST, you just have to re-align your mindset. Instead of > calling a remote method, your REST call creates an object that gives > you the results you are interested in. > > Eg, rather than calling a search service via SOAP to get a list of > items, you would create a SearchResults object with your arguments, > via REST. To access the results, you would use further REST calls to > examine attributes of the object. > > The best way to architecture something like this is with a task queue > system like celery, creating a task to perform the search when the > SearchResults object is created, and testing/waiting for results to be > completed before returning data from attribute calls. > > I think I wouldn't need the task queue cause my functions are short and wouldn't take much processing time, so I guess It's ok to just wait for their output. I think my main problem is thinking about the returning objects, I want to make a standard way for ajax calls on my application so I can easily extend them, and create new ones easily, rather than thinking about it every time. Cheers > > Tom > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

