Hello,

Is it possible to use Django Rest Framework (DRF) for something other than 
models? Here's a trivial example,

To make an API end point which returns the current server time (in JSON 
format, eg: {"current_time": "XYZ"}). It can accept a string to indicate 
timezone, and must accept both GET and POST.

I can figure out how to do the above without DRF using regular Django urls 
and views. What I can't figure out is how to use DRF for the same. 

>From the docs, it looks best to use routers when making a DRF end-point. 
Which means I need a structure like this,

urls.py <-> router <-> Viewset <-> Serializer

But as I understand Serilizers ( 
http://www.django-rest-framework.org/api-guide/serializers/ ), they can 
only be used for complex models or querysets - which is not what I need.

I feel like I'm mis-understanding something about DRF. Help please?

Puzzled,
Abraham V.

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to