开发者

Implementing OData JSON interface on Django (Python)

开发者 https://www.devze.com 2023-01-24 03:37 出处:网络
We would like to have a OData JSON interface on our Django (Python 2.5.4)开发者_如何学JAVA website. At the moment of writing there seems to be no library available.

We would like to have a OData JSON interface on our Django (Python 2.5.4)开发者_如何学JAVA website. At the moment of writing there seems to be no library available.

I'm thinking of writing "some" logic to handle this ourselves.

  • Would it be a good idea to extend the Django JSON serializer?
  • Where and how to store the URI's related to the models?


I think it would be a good idea to extend the Django JSON serializer, but have a look at django-piston this might be the better route to go.

The URI's will have to be defined in your urls.py for your app, and then in your models you could define a function

get_odata_uri()

Which would work like the Django's get_absolute_url(). Instead of hardcoding it into your model, make sure you make use of the reverse function from django.core.urlresolvers

0

精彩评论

暂无评论...
验证码 换一张
取 消