Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?
like image 721
Mark Avatar asked Nov 08 '10 08:11

Mark


1 Answers

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

like image 142
Neskie Avatar answered Sep 29 '22 18:09

Neskie