Actually, I think he wants a custom serializer that has one of 2 get arguments(start and end date) and then generates the desired json with fields using the django aggregate methods
On Tue, 3 Jan 2017, 22:43 gordon, <wgordo...@gmail.com> wrote: > List_route or detail route decorators sounds like what you are looking for > http://www.django-rest-framework.org/api-guide/viewsets/#marking-extra-actions-for-routing > > On Jan 3, 2017 5:09 AM, "Burak Özdemir" <burakozdemi...@gmail.com> wrote: > > I want to create an API endpoint for daily temperatures.(highest and > lowest tempereture of a day). > > 3 Ocak 2017 Salı 13:06:03 UTC+3 tarihinde Marco Silva yazdı: > > What exactly do you need help in? > > > segunda-feira, 2 de Janeiro de 2017 às 22:16:24 UTC, Burak Özdemir > escreveu: > > My sensor measures the temperature value every 5 seconds and records it to > the database. I want to see the highest and lowest temperature of every > recorded day via API. It should be like that(for instance, values are not > correct): > <https://lh3.googleusercontent.com/-ta6cWLUqDWg/WGrQvWjjx4I/AAAAAAAAAlI/owg-mW2gUggSyLBjJM1PaO2HV7Uodo-7ACLcB/s1600/aCLFW.png> > > The modal: > > class SensorModel(models.Model): > measurementTime = models.DateTimeField() > ldr = models.IntegerField() > temperature = models.IntegerField() > humidity = models.IntegerField() > > class Meta: > ordering = ['measurementTime'] > > def __unicode__(self): > return str(self.id) > > > > Database: > > <https://lh3.googleusercontent.com/-T0vWDvxz4o0/WGrQ7VkFUXI/AAAAAAAAAlM/N66JCp7aDx0uipzPiY2o6vud0eM0ff8eACLcB/s1600/U4tl7.png> > > Current API: > > <https://lh3.googleusercontent.com/-alR7rpm_vc4/WGrREkQNZ7I/AAAAAAAAAlQ/vfkQcNAl7Q0BWMJ0qI0FNZl-_Y7lSyHIACLcB/s1600/wRbUN.png> > > Thanks in advance. > > > -- > > 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 django-rest-framework+unsubscr...@googlegroups.com. > > > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Django REST framework" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/django-rest-framework/bhGJR4tndMc/unsubscribe > . > To unsubscribe from this group and all its topics, send an email to > django-rest-framework+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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 django-rest-framework+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.