简体   繁体   中英

Implementing OData JSON interface on Django (Python)

We would like to have a OData JSON interface on our Django (Python 2.5.4) 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM