Hi,

We was talked with Russell on djangocon eu about integrating more rich 
support for working django as rest api provider, focused on dealing with 
one-page web applications.
The motivations that currently without third party modules like 
django-rest-framework or tastypie its quite impossible to create rich web 
applications working as one-page.
As django aims to follow "batteries included" philosophy, so maybe it will 
be a good idea to integrate support for dealing with modern web 
applications.

Better rest apis support conists from two parts: models(and other data 
sources) serialization and handlers.
Django has currently limited support for simple serialization in 
django.core.serializers, but its quite useless in creating rest apis.
Ideally serialization support should have:
* possibility to serialize data to any format by plugabble serializers(in 
core i thing xml and json should be included),
* great integration with django models through eg, adding mixin class to 
model class definition
* possibility to integrate with other data sources(approach with appending 
mixin to class with data fields seems to be good for dealing with this case)
* possibility to provide data mutators as method in api class
* permissions mangement using user object

I propose approach to create class which can work either as mixin to model 
classes or as standalone base for other data sources. In this object we can 
configure serializer class, set up permissions and mutator methods.
This class should have endpoint method like rest_get(self, user, *args, 
**kwargs), which will be called from view/other to get serialized data, 
rest_get, rest_post, rest_put and so on(getting request as first parameter 
i think).
Validations should be integrated through forms I think, its quite mature 
and stable soultion, I dont see any argument to build custom solution.
Serializers should take care on privileges checking, as its coupled with 
user models. As we provide deep integrations with models it seems to be a 
good solution that follows "fat models" approach.

Next thing is dealing with http request. We propose to use CBV and based on 
them create light wrappers to define handled http verbs, provide serializer 
class and errors handling.

The question is, what You're thinking about whole concpet(maybe we won't 
integrate rest api supports in django core and redirect peoples to use 
django-rest-framerwork and similar projects), maybe my ideas are good but 
You find some holes on it?

We're read to implement this solution and maintain them in the future.

Waiting for Your opinion!

Karol




-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to