Re: Introducing ModelView, a RESTful class-based view of your resources
David Larlet wrote: > This is not a secret that I'm interested in both Django and Semantic > Web. I'm following discussion about Django+REST for more than two > years and when I realize that newforms-admin branch will use class- > based generic views [1], I decided that it's probably the right moment > to do something with that. > > [1] http://code.djangoproject.com/ticket/6735 David, this is a good news for us REST-fans :-). However don't you think it could better start living as a separate app? It could get some early adoption without needing to pursue inclusion in trunk. > * Handle receivers in order to use it as an API (for the > moment, >it assumes that you receive formencoded data), need more > reflexion. How about registering handlers for specific mimetypes that would convert from raw data into a python dict. ModelView will have a built-in method for formencoded mimetype and a derived class could add its own like this: @register_mimetype('application/atom+xml') def atom_to_dict(self, data_stream): # parse data_stream return { 'attr': 'value', } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~--~~~~--~~--~--~---
Re: Introducing ModelView, a RESTful class-based view of your resources
Le 8 juin 08 à 16:11, Ivan Sagalaev a écrit : > > David Larlet wrote: >> This is not a secret that I'm interested in both Django and Semantic >> Web. I'm following discussion about Django+REST for more than two >> years and when I realize that newforms-admin branch will use class- >> based generic views [1], I decided that it's probably the right >> moment >> to do something with that. >> >> [1] http://code.djangoproject.com/ticket/6735 > > David, this is a good news for us REST-fans :-). However don't you > think > it could better start living as a separate app? It could get some > early > adoption without needing to pursue inclusion in trunk. Of course, I just want to know if it could be possible as a middle- term goal because it doesn't involve the same energy if it's for me, a couple of REST-fans or the trunk (for example, tests and documentation are not exactly the same). Anyway, I'll setup a repository and add some generic tests, that's the minimum. > >> * Handle receivers in order to use it as an API (for the >> moment, >> it assumes that you receive formencoded data), need more >> reflexion. > > How about registering handlers for specific mimetypes that would > convert > from raw data into a python dict. ModelView will have a built-in > method > for formencoded mimetype and a derived class could add its own like > this: > > @register_mimetype('application/atom+xml') > def atom_to_dict(self, data_stream): > # parse data_stream > return { > 'attr': 'value', > } Yes, that's one of the approaches I'm thinking about, as for permission, using decorators looks to be interesting. I need to write some doc about that too. Thanks for your answer, David --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~--~~~~--~~--~--~---
Re: Introducing ModelView, a RESTful class-based view of your resources
Le 9 juin 08 à 13:52, David Larlet a écrit : > > Le 8 juin 08 à 16:11, Ivan Sagalaev a écrit : >> >> David Larlet wrote: >>> This is not a secret that I'm interested in both Django and Semantic >>> Web. I'm following discussion about Django+REST for more than two >>> years and when I realize that newforms-admin branch will use class- >>> based generic views [1], I decided that it's probably the right >>> moment >>> to do something with that. >>> >>> [1] http://code.djangoproject.com/ticket/6735 >> >> David, this is a good news for us REST-fans :-). However don't you >> think >> it could better start living as a separate app? It could get some >> early >> adoption without needing to pursue inclusion in trunk. > > Of course, I just want to know if it could be possible as a middle- > term goal because it doesn't involve the same energy if it's for me, > a couple of REST-fans or the trunk (for example, tests and > documentation are not exactly the same). > > Anyway, I'll setup a repository and add some generic tests, that's > the minimum. Here it is: http://code.larlet.fr/django-modelviews/ (at least for the first part). I'll setup the base architecture but feel free to participate, push access is granted for all. Cheers, David --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~--~~~~--~~--~--~---
Re: Introducing ModelView, a RESTful class-based view of your resources
Hi David, Thank for your code and the repository, I use the django-rest-interface and it's good news, that someone continue the job. I would like to get nested resources (e.g.: /articles/1/comments/ or /user/username/jobs/) and the problem is that you have to pass statically the queryset. I think I can use a decorator but I don't know how I can do this. Do you have a suggestion? Regards Clément (Sorry for my English, I'm French) -- View this message in context: http://www.nabble.com/Introducing-ModelView%2C-a-RESTful-class-based-view-of-your-resources-tp17718460p18009510.html Sent from the django-developers mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~--~~~~--~~--~--~---
Re: Introducing ModelView, a RESTful class-based view of your resources
Hi Clement, Have a look in the django-rest-interface examples [1] they cover this exactly. You can do what you want by sub-classing Collection. [1] http://code.google.com/p/django-rest-interface/source/browse/trunk/django_restapi_tests/examples/custom_urls.py regards Matthew On Jun 20, 12:15 am, tifosi <[EMAIL PROTECTED]> wrote: > Hi David, > > Thank for your code and the repository, I use the django-rest-interface and > it's good news, that someone continue the job. > > I would like to get nested resources (e.g.: /articles/1/comments/ or > /user/username/jobs/) and the problem is that you have to pass statically > the queryset. I think I can use a decorator but I don't know how I can do > this. Do you have a suggestion? > > Regards > > Clément > > (Sorry for my English, I'm French) > > -- > View this message in > context:http://www.nabble.com/Introducing-ModelView%2C-a-RESTful-class-based-... > Sent from the django-developers mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~--~~~~--~~--~--~---
Re: Introducing ModelView, a RESTful class-based view of your resources
Salut Clément, Le 19 juin 08 à 16:15, tifosi a écrit : > > Hi David, > > Thank for your code and the repository, I use the django-rest- > interface and > it's good news, that someone continue the job. > > I would like to get nested resources (e.g.: /articles/1/comments/ or > /user/username/jobs/) and the problem is that you have to pass > statically > the queryset. I think I can use a decorator but I don't know how I > can do > this. Do you have a suggestion? I'll think about that this weekend, I have some ideas about the way to handle that in an easy way. > > > (Sorry for my English, I'm French) Nobody is perfect ;) Cheers, David ps : you can join us on #django-fr --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~--~~~~--~~--~--~---
Re: Introducing ModelView, a RESTful class-based view of your resources
Thanks for your quick answser ! I join #django-fr and #django. Are you on these channels ? About the solution, I subclass Collection and Entry. Perhaps we can pass the nested Collection to the master Collection ? But we must also pass the reg exp of nested Collection. Bonne soirée Clément David Larlet wrote: > > > Salut Clément, > > Le 19 juin 08 à 16:15, tifosi a écrit : >> >> Hi David, >> >> Thank for your code and the repository, I use the django-rest- >> interface and >> it's good news, that someone continue the job. >> >> I would like to get nested resources (e.g.: /articles/1/comments/ or >> /user/username/jobs/) and the problem is that you have to pass >> statically >> the queryset. I think I can use a decorator but I don't know how I >> can do >> this. Do you have a suggestion? > > I'll think about that this weekend, I have some ideas about the way to > handle that in an easy way. >> >> >> (Sorry for my English, I'm French) > > Nobody is perfect ;) > > Cheers, > David > > ps : you can join us on #django-fr > > > > > > > -- View this message in context: http://www.nabble.com/Introducing-ModelView%2C-a-RESTful-class-based-view-of-your-resources-tp17718460p18035051.html Sent from the django-developers mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~--~~~~--~~--~--~---